Skip to content

Instantly share code, notes, and snippets.

@dostrog
dostrog / Untitled-1
Created January 12, 2020 18:33
Retrieve the name of current branch of git
git rev-parse --abbrev-ref HEAD
@dostrog
dostrog / Use timestamp in PHP
Last active November 24, 2017 09:02
Get timestamp in local TimeZone (PHP)
$dateWithTZ = new DateTime(null, new DateTimeZone('Europe/Moscow'));
$dateTimeNow = $dateWithTZ->getTimestamp() + $dateWithTZ->getOffset();
echo 'Default timezone E/M: '.$dateTimeNow."\r\n";
@dostrog
dostrog / gist:b3cea00ed01f789a44410ce8d7586e7c
Last active March 15, 2017 19:08
Loop through Javascript Object (i.e. JSON object)
for (const key in jsonObj) {
if (jsonObj.hasOwnProperty(key)) {
console.log( key + ' -> ' + jsonObj[key] );
}
}