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
# Three things to add: | |
# * before_filter call | |
# * action_has_layout? method (if you have one, combine them) | |
# * adjust_for_inline | |
# | |
class ApplicationController < ActionController::Base | |
# ... | |
before_filter :adjust_for_inline | |
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 'rubygems' | |
require 'activeresource' | |
PROJECT_ID = 123 | |
TOKEN = 'token' | |
class Iteration < ActiveResource::Base | |
self.site = "http://www.pivotaltracker.com/services/v2/projects/#{PROJECT_ID}" | |
headers['X-TrackerToken'] = TOKEN | |
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
chruby () { | |
v=`ruby -e "puts RUBY_VERSION.split('.')[0,2].join('.')"` | |
if [ $v = "1.9" ]; then | |
cv="1.8" | |
else | |
cv="1.9" | |
fi | |
rubyexes=(erb gem irb rake rdoc ri ruby testrb) | |
for i in ${rubyexes[*]}; do | |
sudo unlink "/opt/local/bin/${i}" |
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
// Knobber | |
// Hook up a potentiometer to tri-color LED | |
int redPin = 9; // red LED, digital pin 9 | |
int greenPin = 10; // green LED, digital pin 10 | |
int bluePin = 11; // blue LED, digital pin 11 | |
int potPin = 0; // potentiometer, analog pin 0 | |
int redVal = 1; | |
int greenVal = 1; |
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
# An experiment at using typhoeus with ActiveResource. It's currently not very | |
# useful (in fact it seems slower). Somehow using the queueing will be the trick | |
require 'typhoeus' | |
module ActiveResource | |
class Connection | |
def get(path, headers = {}) | |
format.decode(Typhoeus::Request.get(@site.host + path, :headers => authorization_header).body) | |
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
user system total real | |
0.050000 0.000000 0.050000 ( 0.043481) | |
0.100000 0.010000 0.110000 ( 0.107440) | |
0.060000 0.000000 0.060000 ( 0.062976) |
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
[' ', 'Evans'].reject(&:blank?).join ' ' |
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 goes in app/assets/html/404.html.erb --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<%= stylesheet_link_tag 'application', :media => 'all' %> | |
<%= javascript_include_tag 'modernizr' %> | |
</head> | |
<body> |
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
var showBody = function() { | |
return $.Deferred(function(def) { | |
$("body").fadeIn(1000, def.resolve); | |
}); | |
}; | |
showBody().then(function() { | |
console.log("body faded in now, let’s dance."); | |
}); |
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
The Artist | |
Senna | |
Hanna | |
Headhunters (Hodejegerne) | |
The Help | |
Best Exotic Marigold Hotel | |
District 9 <- Fookin’ prawns! | |
Crazy Stupid Love | |
The Social Network | |
Black Swan |
OlderNewer