View gist:6186034
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
io.sockets.on('connection', function (socket){ | |
try{ | |
var profileCookie = cookie.parse(socket.handshake.headers['cookie']), | |
profile; | |
if( profileCookie && profileCookie['connect.sess'] ){ | |
profile = profileCookie['connect.sess']; | |
profile = JSON.parse(profile.slice(profile.indexOf('{'), profile.indexOf('}.') + 1)); | |
} | |
} | |
catch(err){} |
View gist:6340626
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 isRTL(s){ | |
var ltrChars = 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF'+'\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF', | |
rtlChars = '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC', | |
rtlDirCheck = new RegExp('^[^'+ltrChars+']*['+rtlChars+']'); | |
return rtlDirCheck.test(s); | |
}; |
View gist:7030050
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
//////////////////////////////////////// | |
// Scroll To / jQuery plugin | |
// | |
// @author Yair Even Or | |
// @version 1.0.0 (April 3, 2013) | |
// | |
(function($){ | |
"use strict"; | |
var currentPos = 0, |
View gist:7059388
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
// mouse move animations | |
$('.container').on('mousemove', moveSquares); | |
function moveSquares(e){ | |
var mousex = (e.pageX - (e.currentTarget.clientWidth/2)) / e.currentTarget.clientWidth; | |
for( i in squares ){ | |
if( i < 6) | |
squares[i].style.cssText = transform + ': translateX('+ Math.ceil(mousex*55) +'px)'; | |
if( i >= 6 && i < 10) |
View gist:7468454
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
[ | |
{ "keys": ["ctrl+x"], "command": "cut" }, | |
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} }, | |
{ "keys": ["ctrl+shift+s"], "command": "reveal_in_side_bar"}, | |
{ | |
"keys": ["ctrl+alt+a"], "command": "align_tab", | |
"args" : {"user_input" : ":/f"} | |
} | |
] |
View gist:7468471
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
{ | |
"highlight_modified_tabs": true, | |
"highlight_line": true, | |
"caret_style": "phase", | |
"wide_caret": true, | |
"fade_fold_buttons": false, | |
"bold_folder_labels": true, | |
"ignored_packages": | |
[ | |
"Vintage" |
View gist:ee337e46173dcdfd0e78
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($){ | |
"use strict"; | |
$.fn.fixPlaceholders = function(){}; | |
if( $.support.placeholders ) | |
return; | |
var selector = 'input[placeholder], textarea[placeholder]', | |
originalType; |
View gist:c4a65143110529383f37
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
// check if PROGRESSIVE image was loaded | |
var duration = 60, | |
interval = setInterval(checkImageLoaded, duration), | |
maxTime = 3000; | |
function checkImageLoaded(){ | |
maxTime -= duration; | |
// image was loaded (or should have been) | |
if( photo.naturalWidth ){ | |
clearInterval(interval); |
View jsbin.nujus.js
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 months = []; | |
for( var i = 0; i < 12; i++ ){ | |
months.push( new Date(0,i).toLocaleString({},{month:'short'}) ); | |
// you can also pass a local like : "en-US" instead of an empty object `{}`. | |
// an empty object triggers the system's auto-detection | |
} | |
console.log(months); |
View gist:9c3b53bbfb00c0ff6c13
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 validateNum = function(num){ | |
num = num.replace(/-/g,''); | |
var calc, i, check, checksum = 0, r = [2,1]; // alternating routing table | |
// iterate on all the numbers in 'num' | |
for( i=num.length-1; i--; ){ | |
calc = num.charAt(i) * r[i % r.length]; | |
//console.log(num.charAt(i), r[i % r.length], [calc]); | |
// handle cases where it's a 2 digits number |
OlderNewer