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
module AssetHelper | |
## | |
# Renders a stylesheet asset inline. | |
def inline_stylesheet( name ) | |
content_tag :style do | |
sprockets[ "#{name}.css" ].to_s | |
end | |
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
osxlabel(){ | |
osascript -e "tell app \"Finder\" to set label index of (POSIX file \"$PWD/$0\" as alias) to 4" | |
} | |
export -f osxlabel | |
git diff --name-only HEAD develop | xargs -n 1 bash -c osxlabel "$@" |
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
alias ip="ifconfig en0 | tail -r | grep inet -m 1 | cut -d ' ' -f 2" |
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
[ :a, :b, :c ].inject( [ [] ] ) { |arr, n| arr.push( arr.last.dup << n ) }.reverse | |
# => [[:a, :b, :c], [:a, :b], [:a], []] | |
class Array | |
def countdown | |
inject( [ [] ] ) { |arr, n| arr.push( arr.last.dup << n ) }.reverse | |
end | |
end | |
query = { |
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 DeliverMessage | |
def self.perform( id ) | |
Message.find( id ).deliver | |
end | |
def self.before_perform_ensure_not_delivered( id ) | |
raise Resque::Job::DontPerform if Message.find( id ).delivered? | |
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
--type-add=ruby=.erb,.haml,.rabl | |
--type-add=js=.coffee | |
--type-add=css=.sass,.scss,.less | |
--type-set=log=.log | |
--nolog |
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 'fog' | |
module AWS | |
class Client | |
def initialize( options={} ) | |
@access_key = options.delete( :access_key ) or raise "AWS::Client requires an :access_key" | |
@secret_key = options.delete( :secret_key ) or raise "AWS::Client requires a :secret_key" | |
@bucket_name = options.delete( :bucket_name ) or raise "AWS::Client requires a :bucket_name" | |
@aws_region = options.delete( :aws_region ) | |
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
# This version works in Rails 3.2 | |
require 'redcarpet' | |
class ActionView::Template | |
class Redcarpet | |
def call( template ) | |
renderer.render( template.source ).inspect | |
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
[{"timestamp":new Date( 2011, 0, 30 ),"identity":"john","event":"signed in"},{"timestamp":new Date( 2011, 0, 15 ),"identity":"john","event":"signed in"},{"timestamp":new Date( 2011, 0, 1 ),"identity":"john","event":"signed in"},{"timestamp":new Date( 2011, 1, 15 ),"identity":"paul","event":"signed in"},{"timestamp":new Date( 2011, 9, 15 ),"identity":"ringo","event":"signed in"},{"timestamp":new Date( 2011, 10, 15 ),"identity":"ringo","event":"signed in"},{"timestamp":new Date( 2011, 11, 15 ),"identity":"ringo","event":"signed in"}].forEach( function( event ){ db.events.insert( event ); } ); |
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
# convert mov to ogv | |
ffmpeg -i RFI_CaseStudy_V3b_DS_720p.mov -vb 3221700 -f ogg RFI.ogv | |
# convert mov to webm | |
ffmpeg -i RFI_CaseStudy_V3b_DS_720p.mov -vb 3221700 -f webm RFI.webm | |
# get a screenshot at the 14s mark | |
ffmpeg -ss 00:00:14 -i RFI_CaseStudy_V3b_DS_720p.mov -vframes 1 RFI.png |