Skip to content

Instantly share code, notes, and snippets.

Marek Čech marekcech

Block or report user

Report or block marekcech

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@marekcech
marekcech / ISO-timezone-with-offset.js
Created Nov 11, 2017
returns ISO timezone with offset
View ISO-timezone-with-offset.js
function() {
// Get local time as ISO string with offset at the end
var now = new Date();
var tzo = -now.getTimezoneOffset();
var dif = tzo >= 0 ? '+' : '-';
var pad = function(num) {
var norm = Math.abs(Math.floor(num));
return (norm < 10 ? '0' : '') + norm;
};
return now.getFullYear()
@marekcech
marekcech / random-ID.js
Last active Nov 11, 2017
Piece of JS which generates random-ID with lenght 10 symbols
View random-ID.js
function() {
return new Date().getTime() + '.' + Math.random().toString(36).substring(10);
}
// node.js
function() {
return new Date().now() + '.' + Math.random().toString(36).substring(5);
}
@marekcech
marekcech / gtag.js
Last active Nov 9, 2017
gtag.js new standard in Google measurement
View gtag.js
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'GA_TRACKING_ID');
</script>
You can’t perform that action at this time.