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
class String | |
def force_valid_encoding | |
find_encoding(Encoding.list.to_enum) | |
end | |
def safe_encode(name) | |
force_valid_encoding | |
encode(name, :undef => :replace, :invalid => :replace, :replace => "") | |
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
require "./state_machine" | |
class Lexer | |
include StateMachine | |
def initialize(source) | |
@source = source | |
@buffer = [] | |
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
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
export JRUBY_OPTS="--1.9" | |
with_env() { | |
env $([ -f ".env" ] && cat .env) $* | |
} | |
alias vim="/usr/local/Cellar/macvim/7.3-64/MacVim.app/Contents/MacOS/Vim" |
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
diff --git a/colors/solarized.vim b/colors/solarized.vim | |
index 70f5223..b92327a 100644 | |
--- a/colors/solarized.vim | |
+++ b/colors/solarized.vim | |
@@ -610,8 +610,10 @@ else | |
exe "hi! NonText" .s:fmt_bold .s:fg_base00 .s:bg_none | |
endif | |
exe "hi! StatusLine" .s:fmt_none .s:fg_base1 .s:bg_base02 .s:fmt_revbb | |
-exe "hi! StatusLineNC" .s:fmt_none .s:fg_base00 .s:bg_base02 .s:fmt_revbb | |
-exe "hi! Visual" .s:fmt_none .s:fg_base01 .s:bg_base03 .s:fmt_revbb |
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
" This theme is based on Solarized-dark colors, combined | |
" with Powerline native colors | |
call Pl#Hi#Allocate({ | |
\ 'black' : 16, | |
\ 'white' : 231, | |
\ | |
\ 'darkestgreen' : 22, | |
\ 'darkgreen' : 28, | |
\ 'mediumgreen' : 70, | |
\ 'brightgreen' : 148, |
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
## web frontend | |
# the web front-end queues up some work to do. | |
queue "document.process", document.attributes | |
## back-end workers | |
# listen for work that needs to be done | |
subscribe "document.process" do |document| | |
# notify the front end that we've started |
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 sync(items) | |
seen = {} | |
do_sync = lambda do |item| | |
return if seen[item] | |
seen[item] = true | |
end | |
items.each &do_sync |
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
# cat .env | |
# MYVAR=1 | |
# | |
# with_env ruby -e "p ENV['MYVAR']" # => 1 | |
# ruby -e "p ENV['MYVAR']" # => nil | |
with_env() { | |
env $([ -f ".env" ] && cat .env) $* | |
} |
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
# encoding: utf-8 | |
require 'minitest/spec' | |
require 'minitest/autorun' | |
puts RUBY_DESCRIPTION | |
describe "Encoding conversions" do | |
def serialize(string) | |
begin |
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
class Document | |
attr_reader :value | |
def initialize(value) | |
@value = value | |
end | |
end | |
class Criteria |