This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @paul_irish Pub/Sub | |
* Works in modern browsers + IE9 | |
* Use Modernizr ployfill for function.bind */ | |
(function($) { | |
var o = $({}); | |
$.subscribe = o.on.bind(o); | |
$.unsubscribe = o.off.bind(o); | |
$.publish = o.trigger.bind(o); | |
}(jQuery)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ir { | |
border: 0; | |
font: 0/0 a; | |
text-shadow: none; | |
color: transparent; | |
background-color: transparent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ir { | |
text-indent: 100%; | |
white-space: nowrap; | |
overflow: hidden; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function RusToTranslit( text ) { | |
return text.replace(/([а-яё])|([\s_-])|([^a-z\d])/gi, | |
function(all, ch, space, words, i) { | |
if (space || words) { | |
return space ? '-' : ''; | |
} | |
var code = ch.charCodeAt(0), | |
next = text.charAt(i+1), | |
index = code == 1025 || code == 1105 ? 0 : code > 1071 ? code - 1071 : code - 1039, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git filter-branch --commit-filter \ | |
'if [ "$GIT_AUTHOR_NAME" = "OldAuthor Name" ]; then \ | |
export GIT_AUTHOR_NAME="Author Name";\ | |
export GIT_AUTHOR_EMAIL=authorEmail@example.com;\ | |
export GIT_COMMITTER_NAME="Commmiter Name";\ | |
export GIT_COMMITTER_EMAIL=commiterEmail@example.com;\ | |
fi;\ | |
git commit-tree "$@"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var args = location.search.substr(1) | |
.split('&') | |
.map(function (pair) { | |
pair = pair.split('='); | |
try { | |
pair[1] = pair[1] !== undefined ? decodeURIComponent(pair[1]) : true; | |
if (typeof pair[1] === 'string') { | |
pair[1] = pair[1].replace(/\+/g, ' '); | |
if (pair[1].indexOf(',') !== -1) { | |
pair[1] = pair[1].split(','); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Benchmark = require('benchmark').Benchmark; | |
const suite = new Benchmark.Suite(); | |
function uid() { | |
return 'xxx'.replace(/x/g, function(c) { | |
return Math.floor(Math.random()*10); | |
}); | |
} | |
const count = 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Benchmark = require('benchmark').Benchmark; | |
const siphash = require('siphash'); | |
const murmur = require('murmur'); | |
const HASH_KEY = siphash['string16_to_key']('A054ED26FF2BC196'); | |
const suite = new Benchmark.Suite('Generate Hash'); | |
var hash; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
items[ Math.floor(Math.random() * items.length) ] | |
items[ ~~(Math.random() * items.length) ] | |
items[ Math.random() * items.length >>> 0 ] |
OlderNewer