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
| scope :latest_by_hashtag, lambda {|hashtag| { | |
| :where => { :hashtags => hashtag }, | |
| :order_by => :tweeted_at.desc, | |
| :limit => 20 } | |
| } | |
| # OR # | |
| module MyModelModules | |
| module Scopes |
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
| ### Without libpng installed | |
| $ brew install -v povray | |
| ==> Build Environment | |
| CC: /usr/bin/cc => /usr/bin/gcc-4.2 | |
| CXX: /usr/bin/c++ => /usr/bin/c++-4.2 | |
| LD: /usr/bin/cc => /usr/bin/gcc-4.2 | |
| CFLAGS: -O3 -w -pipe | |
| CXXFLAGS: -O3 -w -pipe | |
| MAKEFLAGS: -j4 |
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
| :%s/{/(/g|%s/}/)/g | |
| jr}w./[ | |
| r{jj.kF(r[f)r]ZZ |
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 'openssl' | |
| require 'base64' | |
| secret_message = 'foo!' | |
| aes = OpenSSL::Cipher.new 'AES-256-CBC' | |
| aes.encrypt | |
| iv = aes.random_iv # never EVER use the same IV if you're reusing a key | |
| rnd = aes.random_key |
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 CreateJoinTableForDomainsAndUsers < ActiveRecord::Migration | |
| def change | |
| create_table :domains_users, id: false do |t| | |
| t.integer :user_id | |
| t.integer :domain_id | |
| end | |
| add_index :domains_users, [:user_id, :domain_id] | |
| add_index :domains_users, [:domain_id, :user_id] | |
| end | |
| 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
| // ... | |
| // source pretty-printed | |
| // some values elided/obscured since I'm not sure which ones are sensitive... though the one's remove are certainly not able to be keyed off of | |
| foo = [ | |
| ["DATABASE_URL","postgres://user:pass@127.0.0.1/dbname"], | |
| ["SSH_CLIENT","10.194.1.1 12345 12346"], | |
| ["USER","xxxxxx"], | |
| ["MAIL","/var/mail/xxxxxx"], | |
| ["RAILS_GROUPS","assets"], | |
| ["SHLVL","1"], |
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 | |
| if [[ "$1" == "--fail" ]] | |
| then | |
| echo 'Instruments Trace Error' | |
| fi | |
| if [ -t 1 ] | |
| then | |
| echo A |
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 Fixnum | |
| def to_roman | |
| return '' if self == 0 | |
| roman, arabic = { | |
| M: 1000, | |
| CM: 900, | |
| D: 500, | |
| CD: 400, | |
| C: 100, | |
| XC: 90, |
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
| honor TravisCI(原*) rake test | |
| running: /Users/brad/dev/bwoken/bin/unix_instruments.sh -D /Users/brad/dev/ios/TravisCI/integration/tmp/trace -t /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -v /Users/brad/dev/ios/TravisCI/build/TravisCI.app -e UIASCRIPT /Users/brad/dev/ios/TravisCI/integration/tmp/javascript/iphone/favorites.js -e UIARESULTSPATH /Users/brad/dev/ios/TravisCI/integration/tmp/results | |
| Instruments : Plugin Search Paths ( | |
| "/Users/brad/Library/Application Support/Instruments/PlugIns", | |
| "/Library/Application Support/Instruments/PlugIns", | |
| "/Applications/Xcode.app/Contents/Developer/usr/PlugIns", | |
| "/Applications/Xcode.app/Contents/Developer/usr/bin/PlugIns", | |
| "/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns", | |
| "/Applications/Xcode.app/Contents/Developer/Library/Instruments/PlugIns", |
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
| # Do NOT assume this is production code. | |
| class String | |
| def to_is | |
| self.chars.map(&:to_i) | |
| end | |
| end | |
| def luhn cc | |
| cc. |