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
<ol class="wizard-nav"> | |
<li class="done"><a href="#">Step 1</a></li> | |
<li class="done"><a href="#">Step 2</a></li> | |
<li class="active"><a href="#">Step 3</a></li> | |
<li><a href="#" data-disabled>Step 4</a></li> | |
<li><a href="#" data-disabled>Step 5</a></li> | |
</ol> |
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
# :facepalm: | |
class User < ActiveRecord::Base | |
validate do |user| | |
if user.login.blank? | |
user.errors.add_to_base("User Name can't be blank") | |
else | |
user.errors.add_to_base("User Name is too short(Minimum is 3 characters)") if user.login.length<3 and user.login.length !=0 | |
user.errors.add_to_base("User Name is too long(Maximum is 3 characters)") if user.login.length>40 | |
user.errors.add_to_base("User Name has already been taken.") if User.find_by_login(user.login) |
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
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 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 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 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://gist.github.com/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 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 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 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 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 |