PT1ncmJlZXVobXVtNFMrbUlXK2F6RkdkekZXVFFpbzVNNmE1 PWdKcWwzNHJtakl1a0g0cG96NWltekl2dmZJdWtYVE1ucUw1RVdMNjZxTDVxaUw1 TytaNS9XWjY3Nlk1NGk0NTRpNDVtaWI1TXk3N2FtYTVRaW81MENaNVBDYjVPaUw1TXk3NzQrWTVzV1k1RXE1NXhlYjVxZUk2SnlwNUZDSTZXaW81SWliNUU2cDUyNnA1NmlMNVFpbzU=
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
quickSort = (arr)-> | |
debugger | |
return arr if arr.length < 2 | |
left = [] | |
right = [] | |
for i in [1...arr.length] | |
if arr[0] > arr[i] | |
left.push arr[i] | |
else | |
right.push arr[i] |
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
maxHeapify = (arr, i, heapSize)-> | |
left = i * 2 + 1 | |
right = i * 2 + 2 | |
largest = i | |
if left < heapSize && arr[i] < arr[left] | |
largest = left | |
if right < heapSize && arr[largest] < arr[right] | |
largest = right | |
if largest isnt i | |
temp = arr[i] |
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
str = "" | |
for i in [0x0000..0xffff] | |
str += String.fromCharCode(i) | |
console.log str | |
### | |
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƻƼƽƾƿǀǁǂǃDŽDždžLJLjljNJNjnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZDzdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɂɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯʰʱʲʳʴʵʶʷʸʹʺʻʼʽʾʿˀˁ˂˃˄˅ˆˇˈˉˊˋˌˍˎˏːˑ˒˓˔˕˖˗˘˙˚˛˜˝˞˟ˠˡˢˣˤ˥˦˧˨˩˪˫ˬ˭ˮ˯˰˱˲˳˴˵˶˷˸˹˺˻˼˽˾˿̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼͇͈͉͍͎̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌̕̚ͅ͏͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮͯ͘͜͟͢͝͞͠͡ͰͱͲͳʹ͵Ͷͷͺͻͼͽ;Ϳ΄΅Ά·ΈΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪ |
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
getDaysByMonth = (date = new Date(), fill=true, chinese = true) -> | |
date.setDate(1) | |
day = date.getDay() | |
month = date.getMonth() | |
days = [] | |
while date.getMonth() == month | |
days.push new Date(date.getTime()) | |
date.setDate(date.getDate() + 1) | |
monthCount = days.length | |
if fill |
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
calculateDOMDepth = (doc = document)-> | |
max = 0 | |
_calculateDOMDepth = (dom)-> | |
domdepth = dom.dataset.domdepth = parseInt(dom.parentNode.dataset.domdepth) + 1 | |
max = domdepth if domdepth > max | |
Array.prototype.forEach.call dom.children, (child)-> | |
_calculateDOMDepth(child) | |
body = doc.body | |
body.parentNode.dataset.domdepth = 0 | |
_calculateDOMDepth(body) |
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 body, listener; | |
listener = { | |
handleEvent: function (evt) { | |
return console.log(evt.type); | |
} | |
}; | |
body = document.body; | |
body.addEventListener("click", listener); | |
body.addEventListener("keyup", listener); |
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
// File: global.js | |
var timestamp = new Date() | |
exports.global = { | |
timestamp: timestamp | |
} | |
console.log('timestemp from global.js is ' + timestamp) | |
// File: foo.js | |
var _global = require('./global').global |
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
" vundle | |
" git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle | |
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
" required! |
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
require 'mail' | |
require 'gmail' | |
require 'base64' | |
gmail = Gmail.connect('[email protected]', 'password') | |
emailComeFromSomeone = gmail.inbox.find(:before => Date.parse("2012-10-01"), :after => Date.parse("2012-09-01"), :from => '[email protected]') | |
emailComeFromSomeone.each do |mail| | |
begin |