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 A | |
| # Allow read access to var | |
| attr_reader :var | |
| # Set the INSTANCE variable var | |
| def set | |
| @var = "I am an instance variable" | |
| end | |
| # Print the LOCAL variable |
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
| var ||= "I'm a local variable" |
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
| Factory.define :coffeeshop do |s| | |
| s.sequence(:location) { |n| "town#{n}"} | |
| end | |
| Factory.define :coffee do |c| | |
| c.sequence(:name) { |n| "coffee#{n}"} | |
| c.tried false | |
| c.association :coffeeshop | |
| 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
| def new | |
| @a = A.new | |
| @b = @a.b | |
| end | |
| def create | |
| @a = A.new(params[:a]) | |
| @a.b_id = B.find(params[:b_id]).id | |
| if @a.save | |
| redirect_to(@a.b) |
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 new | |
| @a = A.new | |
| @b = @a.b | |
| end | |
| def create | |
| @a = A.new(params[:a]) | |
| @a.b_id = B.find(params[:b_id]).id | |
| @b = @a.b | |
| if @a.save |
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
| @font-face { | |
| font-family: 'Impact Label Regular'; | |
| src: url(http://fonts.sideshowcoder.com/fonts/impact_label/Impact_label-webfont.eot); | |
| src: local('Impact Label Regular'), | |
| url(http://fonts.sideshowcoder.com/fonts/impact_label/Impact_label-webfont.ttf) format('truetype'), | |
| url(http://fonts.sideshowcoder.com/fonts/impact_label/Impact_label-webfont.svg#font) format('svg'); | |
| } |
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
| location ~* \.(eot|ttf|woff)$ { | |
| add_header Access-Control-Allow-Origin *; | |
| } |
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
| /* Extend Array to allow packing to Buffer | |
| * | |
| * Inspired by ruby array pack method | |
| * | |
| * Takes a format fmt and walks the array | |
| * C = Element is interpreted as ASCII character (unsigned char) | |
| * a = Element is interpreted as ASCII string | |
| * n = Element is interpreted as Short generating a 2 octets | |
| * | |
| * Just for the hack of it ;) |
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
| #!/bin/bash | |
| FILES=$(ls *.tif) | |
| for f in $FILES; do | |
| NN=`echo $f | sed -e"s/\_1\./\_gfp\./"` | |
| mv $f $NN | |
| done |
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
| find ./ -name "*.js" -exec cat '{}' \; | awk 'match($0,/L\(.+\)/) { print substr($0,RSTART+3,RLENGTH-5) }' | awk 'split($0, M, /\)/) { print M[1] }' | sed 's/\"//g' | sed "s/\'//g" | sort | uniq |
OlderNewer