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){} |
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); | |
}; |
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, |
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) |
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"} | |
} | |
] |
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" |
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; |
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); |
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); |
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