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
module.exports = buddy = (ary) -> | |
result = [] | |
while ary.length | |
left = ary.shift() | |
right = ary.shift() | |
obj = {} | |
obj[left] = right | |
result.push obj | |
result |
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
git branch --remote --merged | cut -d"/" -f 2 | grep feature | xargs -Iarg git push origin :arg |
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
# ใฏใคใใฏ | |
qSort = (ary) -> | |
if ary.length <= 1 | |
return ary | |
center = Math.floor (ary.length / 2) | |
pivot = ary[center] | |
left = [] | |
right = [] | |
for val in ary | |
if val < pivot |
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 getRandomStr = function(l){var re = "";for(var i = 0;i < l;i++)re+=Math.floor(Math.random()*10);return re;}; |
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
class AsyncSeriesModel extends Backbone.Model | |
# ้ๅๆใง็ดๅใชใฏใจในใใใ | |
lastRequest = new $.Deferred().resolve() | |
sync: -> | |
argRaw = arguments | |
# ๅผใณๅบใๅ ใซ่ฟๅดใใdeferredใชใใธใงใฏใ | |
dfd = new $.Deferred | |
# ๅๅใชใฏใจในใๅใ่งฃๆฑบใใใฎใๅพ ใค |
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
# try-catch ใฏๅคใใใใ | |
res = try | |
sippaisisou() | |
catch e | |
{} | |
# ้ขๆฐใซ่คๆฐใฎ้ขๆฐใๆธกใ | |
asyncHoge( | |
-> | |
alert 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
#!/bin/sh | |
DIR=~/repos/hogehoge/ | |
match=' class .+extends' | |
for filepath in `git grep -l -E "$match"` | |
do | |
classname_raw=`grep -o -E "$match" $filepath` | |
classname=`echo $classname_raw| cut -d' ' -f2` |
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
#!/usr/bin/env coffee --nodejs --harmony | |
request = require 'request' | |
fs = require 'fs' | |
# mock request | |
#request = (str, cb)-> | |
# setTimeout -> | |
# cb null, null, "{\"hoge\": \"#{str}\"}" | |
# , 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
399 http://localhost:80 | |
146 http://localhost:3000 | |
87 http://localhost:8080 | |
32 http://localhost:8000 | |
27 http://localhost:631 | |
25 http://localhost:5000 | |
24 http://localhost:8888 | |
23 http://localhost:4567 | |
13 http://localhost:4000 | |
12 http://localhost:9292 |
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
class ConvertCSV extends Backbone.Collection | |
makeCSVStr: (headers) -> | |
body = @map (model) -> | |
headers.map((header)-> | |
'"' + "#{model.get(header)}".replace(/"/g, '""') + '"').join "," | |
[headers.map((header)-> "\"#{header}\"").join ','].concat(body).join('\n') | |
con = new ConvertCSV [ | |
{hoge: "\"", fuga: 4, bar: 0} |