This file contains hidden or 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
--------------------------------------------------- | |
Sample of Structure | |
/express.js | |
/views/javascript/jquery.js | |
/views/javascript/mootools.js | |
/views/stylesheets/resets.css | |
/views/stylesheets/globals.css |
This file contains hidden or 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
data:image/gif;base64,R0lGODlhAQABAAAAACw= |
This file contains hidden or 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 () { | |
// Shortcuts | |
var C = CryptoJS; | |
var C_lib = C.lib; | |
var Hasher = C_lib.Hasher; | |
var C_x64 = C.x64; | |
var X64Word = C_x64.Word; | |
var X64WordArray = C_x64.WordArray; | |
var C_algo = C.algo; |
This file contains hidden or 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.onmousemove = logMouseMove; | |
function logMouseMove(event) { | |
e = e || window.event; | |
mousePos = { x: e.clientX, y: e.clientY }; | |
console.log(mousePos); | |
} |
This file contains hidden or 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
# pick all deleted files and remove them | |
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm % | |
This file contains hidden or 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
getRandom = function(){ | |
var date = new Date().getTime(); | |
var random = Math.floor((Math.random()*800)+100); | |
return(date+random).toString(36); | |
}; |
This file contains hidden or 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
// edited code (origin from http://imei.sms.eu.sk/index.html) | |
// ach, I hate italic | |
luhn = {}; | |
luhn.calculate = function(originalStr){ | |
var sum=0, delta=[0,1,2,3,4,-4,-3,-2,-1,0], | |
deltaIndex, deltaValue; |
This file contains hidden or 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
// Variant of Avraham Plotnitzky's String.prototype method mixed with the "fast" version | |
// see: https://sites.google.com/site/abapexamples/javascript/luhn-validation | |
function luhnChk(luhn) { | |
var len = luhn.length, | |
mul = 0, | |
prodArr = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]], | |
sum = 0; | |
while (len--) { |
This file contains hidden or 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 iterateArrayToFirstResult(arr){ | |
loop: { | |
for (var i=0; i<arr.length; i++) { | |
if (arr[i]==42) { | |
console.log('You just found answer to the ultimate question of Life'); | |
break loop; | |
} | |
console.log('Your array havent number 42'); | |
} | |
} |
This file contains hidden or 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
/* from photo mongo database and s3 */ | |
var removePhoto = function(){ | |
mongoclient.connect(database, function(err, db) { | |
if (err) throw err; | |
/* url../remove?98c582c7d329/3b1fa423d917 - album:98c582c7d329 photo:3b1fa423d917 */ | |
var url = require('url').parse(req.url).query; | |
var album = underscore.words(url, '/')[0]; | |
var photo = underscore.words(url, '/')[1]; |