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
| #!/usr/bin/env ruby | |
| branches = `git branch` | |
| branches.each_line do|line| | |
| branch = line.gsub(/\s/,"") | |
| next if branch[0] == "*" | |
| puts "################" | |
| puts "#{branch}\n" | |
| puts "################" | |
| puts `git branch -d #{branch}` |
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! ReadJSFile() abort | |
| let s:currentPos = col('.') | |
| let s:colNum = s:currentPos - 1 | |
| let s:lastPos = len(getline('.')) | |
| let s:fileName = '' | |
| while s:colNum > -1 | |
| if getline('.')[s:colNum] =~ "\['\"\]" | |
| break | |
| end |
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
| execute pathogen#infect() | |
| syntax on | |
| ab conlog <script>console.log("<%= %>")</script> | |
| ab vimed sp ~/.vimrc<CR> | |
| nmap ! :execute ":lcd " . expand("%:p:h")<CR> | |
| map <C-f> :let @* = expand("%:p")<CR> | |
| let g:skk_auto_save_jisyo=1 | |
| let g:skk_large_jisyo='~/.vim/SKK-JISYO.L' | |
| set ts=2 | |
| set sw=2 |
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
| #!/bin/env ruby | |
| $HEX = false | |
| if ARGV[0] == "-x" | |
| $HEX = true | |
| ARGV.shift | |
| end | |
| if ARGV.length != 1 | |
| puts "#{$0} outputfile" | |
| exit -1 |
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
| JsLoader = function(srcMap){ | |
| this.srcMap = {}; | |
| for(key in srcMap){ | |
| this.srcMap[key] = {state: "unload",src: srcMap[key],cb: []} | |
| } | |
| }; | |
| JsLoader.prototype = { | |
| load: function(m,cb){ | |
| var that = this; | |
| if(!this.srcMap[m]){ |
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
| var static = require('node-static'); | |
| var file = new static.Server('.'); | |
| server = require('http').createServer(function (request, response) { | |
| request.addListener('end', function () { | |
| file.serve(request, response); | |
| }).resume(); | |
| }) | |
| server.listen(60000); | |
| var io = require('socket.io').listen(60001); | |
| io.sockets.on('connection', function(socket){ |
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
| def calc_month(t,n) | |
| y = t.year | |
| m = t.month + n | |
| if m < 1 | |
| y += ((m-1)/12).floor | |
| m = 12 + (m % -12) | |
| elsif m > 12 | |
| y += (m/12).floor | |
| m = ((m-1) % 12) + 1 | |
| end |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script type="text/javascript" src="js/jquery.js"></script> | |
| <script type="text/javascript" src="js/underscore.js"></script> | |
| <script type="text/javascript" src="js/backbone.js"></script> | |
| <script type="text/javascript" src="js/socket.io.min.js"></script> | |
| <script type="text/javascript" src="js/io-reqev-client.js"></script> | |
| <title>sample</title> | |
| </head> |
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
| var events = require('events'); | |
| var Timer = function(){ | |
| this.events = ["five","ten","thirty"]; | |
| var that = this; | |
| setInterval(function (){ | |
| var now = new Date(); | |
| if(now.getSeconds() % 5 == 0){ | |
| that.emit("five", {time: now.toString()}); | |
| } | |
| if(now.getSeconds() % 10 == 0){ |
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
| var IOReqEv = require('socket.io-reqev'); | |
| var ioReqEv = new IOReqEv(require('socket.io').listen(50000)); | |
| var Timer = require('./timer'); | |
| ioReqEv.register("/timer",new Timer()); | |
| //temporary web server | |
| var static = require('node-static'); | |
| var file = new static.Server('.'); | |
| require('http').createServer(function (request, response) { | |
| request.addListener('end', function () { | |
| file.serve(request, response); |