Skip to content

Instantly share code, notes, and snippets.

View pchw's full-sized avatar

Hiroshi HORIKI pchw

View GitHub Profile
@pchw
pchw / Default (OSX).sublime-keymap
Created February 4, 2015 01:30
ST3 keymap[Library/Application Support/Sublime Text 3/Packages/User/Default (OSX).sublime-keymap]
[
{"keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": false }},
{ "keys": ["ctrl+s"], "command": "show_panel", "args": {"panel": "find", "reverse": false} },
{ "keys": ["ctrl+r"], "command": "show_panel", "args": {"panel": "find", "reverse": true} },
{ "keys": ["ctrl+s"], "command": "find_next", "context":
[{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}]
},
{ "keys": ["ctrl+r"], "command": "find_prev", "context":
[{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}]
}
@pchw
pchw / output.txt
Last active August 29, 2015 14:13
stream test
$ DEBUG=sample coffee stream.coffee
sample EventEmitter onPush +0ms
sample Channel Filter 1 Stream In +1ms
sample Channel Filter 2 Stream In +2ms
sample OutputStream._write +0ms
{
"report": {
"channel1": "channel1",
"channel2": "channel2"
},
@pchw
pchw / queue.coffee
Created December 2, 2014 07:40
checking async.queue0.2.9
async = require 'async'
q = async.queue (x,done)->
console.log 'queue run'
do done
q.drain = ->
console.log 'drained'
count = 0
@pchw
pchw / pass.go
Last active August 29, 2015 14:06
ternary failed
package main
import (
"fmt"
)
func main() {
var foo = map[bool]string{true: "foo", false: "bar"}[true]
fmt.Println("Hello Go", foo)
@pchw
pchw / [NG]_promise_failed_flow.coffee
Last active August 29, 2015 14:06
promise reject flow
Promise = require 'bluebird'
methodC = ->
new Promise (resolve, reject)->
setTimeout ->
console.log 'methodC'
reject 'methodC failed'
, 1000
methodB = ->
new Promise (resolve, reject)->
setTimeout ->
@pchw
pchw / patternA.coffee
Last active August 29, 2015 14:06
Promise Sample
Promise = require 'bluebird'
methodB = ->
new Promise (resolve, reject)->
setTimeout ->
console.log 'methodB'
reject 'hoge'
, 1000
methodA = (param)->
@pchw
pchw / start_markdown.md
Created August 12, 2014 07:26
マークダウン入門

Markdown入門

Markdownはただのテキストでありながら,構造的な文章を書くための記法です. 装飾を表現するための手法が最低限しか無いため,きちんとした文章を手軽に書くための記法として最適です.

また,HTMLなどに変換する際にきちんとマークアップされるため綺麗な見た目にして表示することも容易です.

議事録・メール・GitHub上での議論など様々なところで見やすく構造的な文章を書くにあたって大いに役立ちます.

@pchw
pchw / index.coffee
Created July 12, 2014 03:45
コマンドライン引数の文字列をvoicetext web apiで喋らせる
require 'coffee-script/register'
fs = require 'fs'
stream = require 'stream'
Speaker = require 'speaker'
VoiceText = require '../src/lib/voicetext'
voice = new VoiceText('<your api key>')
text = process.argv[2] or 'きょうも いちにち がんばるぞい'
class Base
class LibraryName.Klass extends Base
constructor: ->
@name = @constructor.name
@namespace = "?"
Parent = exports? and exports or @Parent = {}
@pchw
pchw / Gruntfile.coffee
Created June 10, 2014 05:50
use power-assert on .coffee test
module.exports = (grunt) ->
require('time-grunt')(grunt)
require('load-grunt-config')(grunt)