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
// see https://tools.ietf.org/html/rfc4122#section-4.4 | |
function uuid () { | |
var seeds = random(12) | |
// inspired by https://github.com/broofa/node-uuid/blob/v2.0.0/uuid.js#L362 | |
seeds[5] = (seeds[5] & 0x0fff) | 0x4000 // version bits | |
seeds[7] = (seeds[7] & 0x3fff) | 0x8000 // clock_seq_hi_and_reserved bits | |
return 'xx-x-x-x-xxx'.replace(/x/g, function (x, index) { return hex(seeds[index]) }) | |
function random (n) { // get n random 16-bit unsigned integers |
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($){ | |
$.toAscii = $.extend( | |
function toAscii (string) { | |
$.each(toAscii.diacritics, function(){ | |
string = string.replace(this[1], this[0]); | |
}); | |
return string; | |
}, { | |
diacritics: [ | |
['A', /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g], |
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
/** | |
* Gradient Background test | |
*/ | |
body{ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 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
cd ~ | |
mkdir .gyp | |
nano .gyp/include.gypi | |
paste the following | |
{ | |
'variables': { | |
'linux_use_gold_binary' : 0, | |
'linux_use_gold_flags' : 0, | |
'target_arch': 'arm', | |
'disable_nacl': 1, # NaCL does not build for ARM. |
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( $ ) { | |
var d = $(document), | |
log = function (event) { d.on(event, function(e) { console.log(event, e.type, e.namespace, e.namespace_re) }) } | |
log("test") | |
log("test.a") | |
log("test.b") | |
log("test.b.a") | |
log("test.c") |
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
window.jsonP = function ( url, callback, paramName ) { | |
var self = arguments.callee // this function | |
, queue = self.queue || ( self.queue = {} ) // callback queue | |
, name = 'jsonP' + Object.keys( queue ).length + '_' + Date.now() // unique callback name | |
, global = 'jsonP.queue.' + name // global callback name | |
, placeholder = /(=)\?(?=&|$)/ // placeholder pattern | |
, script = document.createElement( 'script' ) // script dom node | |
; | |
script.type = 'text/javascript'; | |
script.src = placeholder.test( url ) ? |
NewerOlder