View 0_reuse_code.js
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View evalex.rb
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 'strscan' | |
=begin | |
神奈川Ruby会議01のペアプロ問題から。 http://nabetani.sakura.ne.jp/kanagawa.rb/evalex/ | |
ちょうど今読んでいる http://www.amazon.co.jp/Programming-Principles-Practice-Using-Edition/dp/0321992784 | |
に電卓を作る例があったので、ほとんど写経するような形で書いてみた。 | |
書いておきながら細かいところをちゃんと説明できないので途中まで書いていてすごく不安だった... | |
=end | |
Token = Struct.new(:kind, :string) |
View file0.txt
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/bash | |
current_branch=$(git rev-parse --abbrev-ref HEAD) | |
warn_branch() { | |
echo "You can't commit on '$current_branch'!" | |
} | |
case $current_branch in | |
master) warn_branch; exit 1 ;; # Of cource you can add any other important branches as you need. |
View gist:3f71a70e69a7fa051091
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
$ npm install | |
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.4","npm":"2.10.1"}) | |
node-webkit-winstate@1.1.1 node_modules\node-webkit-winstate | |
intelli-espower-loader@0.6.0 node_modules\intelli-espower-loader | |
parse-github-event@0.2.0 node_modules\parse-github-event | |
bluebird@2.9.27 node_modules\bluebird |
View file0.vim
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
"ひらがな・カタカナ・全角アルファベットによるコマンド入力を有効にする | |
noremap あ a | |
noremap い i | |
noremap う u | |
noremap え e | |
noremap お o | |
noremap ア a | |
noremap イ i | |
noremap ウ u | |
noremap エ e |
View mark-on-update.rb
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
=begin | |
Termtter plugin. | |
Mark everytime timeline is updated. inspired by plugin/mark.rb | |
=end | |
config.plugins.mark_on_update.set_default( :wrap_color, 'on_red' ) | |
config.plugins.mark_on_update.set_default( :time_format, 'TIMELINE at %R' ) | |
Termtter::Client.register_hook( | |
:name => :mark_on_update, | |
:points => [:post_filter], |
View split_between.rb
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/ruby -wKu | |
# vim: set fileencoding=utf-8 : | |
=begin | |
return the results of both Enumerable#take and Enumerable#drop | |
=end | |
module Enumerable | |
def split_between val | |
first = true | |
first_ary = [] |
View socket-specs.rb
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 'socket' | |
module SocketSpecs | |
# helper to get the hostname associated to 127.0.0.1 | |
def self.hostname | |
# Calculate each time, without caching, since the result might | |
# depend on things like do_not_reverse_lookup mode, which is | |
# changing from test to test | |
Socket.getaddrinfo("127.0.0.1", nil)[0][2] | |
end |
View object-pattern.rb
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/ruby -wKu | |
# vim: set fileencoding=utf-8 : | |
class ObjectPattern | |
def initialize obj, method=:[] | |
@delegate_object = obj | |
@delegate_method = method | |
end | |
attr_reader :delegate_object, :delegate_method | |
def === other |
OlderNewer