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
ps aux | grep -E -i "[j]ruby.*(rails s|rake)" | awk '{print $2}' | xargs kill -9 |
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
~/src/chef-repo $ knife cookbook site vendor mysql -d | |
WARNING: No knife configuration file found | |
Installing mysql to /var/chef/cookbooks | |
ERROR: The cookbook repo path /var/chef/cookbooks does not exist or is not a directory |
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 Payment | |
FEE_RATE = 0.029 # 2.9% | |
TRANSACTION_FEE = 0.15 | |
attr_reader :amount | |
def initialize(amount) | |
@amount = amount | |
end |
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
do shell script "diskutil mountDisk `disktool -l | grep Backup | awk '{ print substr($0,20,7) }'`" |
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 'net/scp' | |
namespace :db do | |
desc 'pull the latest backup & restore locally' | |
task :restore do | |
Rake::Task['db:download'].invoke | |
Rake::Task['db:replace'].invoke | |
end | |
desc 'pull down the lastest backup from production' |
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 'uri' | |
require 'net/http' | |
desc "Download some files" | |
task :download do | |
uri = URI.parse('http://www.google.com') | |
# shell to curl | |
system %Q{curl -o google.html #{uri}} |
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
generators = [] | |
puts 'Spinning up a new app, captain!' | |
devise = yes?('Use Devise? (yes/no)') | |
jquery = yes?('Use jQuery? (yes/no)') | |
jquery_ui = yes?('Use jQuery UI? (yes/no)') if jquery | |
mongoid = yes?('Use mongoid? (yes/no)') | |
haml = yes?('Use haml? (yes/no)') | |
rspec = yes?('Use Rspec? (yes/no)') |
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
=gradient-bg($color, $top: 5, $bottom: $top) | |
@if $top < 0 and $bottom < 0 | |
$color1: darken($color, abs($top)) | |
$color2: lighten($color, abs($bottom)) | |
+linear-gradient(color-stops($color1, $color2)) | |
@else | |
$color1: lighten($color, abs($top)) | |
$color2: darken($color, abs($bottom)) | |
+linear-gradient(color-stops($color1, $color2)) | |
background-color: $color |
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 'httparty' | |
require 'grit' | |
require 'pathname' | |
module Wikipedia | |
class Revision | |
def initialize(article, revision) | |
@article = article | |
@revision = revision |
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/echo '{"version": "1.1.0","host": "maps.google.com","request_address": true,"address_language": "en_US", "wifi_towers": [{"mac_address": "' $(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s | grep -o "\([0-9a-f]\{2\}:\)\{5\}[0-9a-f]\{2\}" | head -1 ) '","signal_strength": 8,"age": 0}]}' | sed -e 's/" /"/' -e 's/ "/"/g' > /tmp/post.$$ && curl -X POST -d @/tmp/post.$$ http://www.google.com/loc/json | sed -e 's/{/\n/g' -e 's/,/\n/g' |