Skip to content

Instantly share code, notes, and snippets.

@Lytol
Lytol / gist:1065962
Created July 5, 2011 21:14
Body tag helper that sets class and id based on controller/action
def body_tag(&blk)
controller_name = controller.class.to_s.underscore.gsub(/_controller$/, '').gsub(/\//,'_')
action_name = controller.action_name.underscore.gsub(/_/,'-')
content_tag(:body, :id => "#{controller_name}-#{action_name}", :class => controller_name, &blk)
end
@Lytol
Lytol / gist:1047900
Created June 26, 2011 19:34
GitConfig
[core]
editor = /usr/bin/vim
[alias]
st = status
br = branch
d = diff
ci = commit -v
cia = commit -v -a
co = checkout
cp = cherry-pick
begin
require 'autotest/growl'
Autotest::Growl::image_dir = File.join(ENV['HOME'], '.autotest-growl')
Autotest::Growl::hide_label = true
Autotest::Growl::clear_terminal = false
rescue LoadError
puts "No Growl support -- gem install autotest-growl"
end
TARGET=pomodoro
MCU=attiny13
CC=/usr/bin/avr-gcc
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=$(MCU)
OBJ2HEX=/usr/bin/avr-objcopy
AVRDUDE=/usr/bin/avrdude
program : $(TARGET).hex
sudo $(AVRDUDE) -c usbtiny -p$(MCU) -U flash:w:$(TARGET).hex
require 'spec_helper'
describe ApplicationController do
controller do
def public; head :ok; end
end
it "should be successful" do
get :public
response.should be_ok
import sbt._
class AlgorithmDesignManualProject(info: ProjectInfo) extends DefaultProject(info) {
val specs = "org.scala-tools.testing" % "specs" % "1.6.2.1" % "test"
}
bsmith bundler (1-0-stable) $ grep -n -r "no-cache" ./
./lib/bundler/cli.rb:139: method_option "no-cache", :type => :boolean, :banner =>
bsmith bundler (1-0-stable) $ grep -n -r "no_cache" ./
bsmith bundler (1-0-stable) $
bsmith bundler (1-0-stable) $ git log --oneline | grep "no-cache"
4601dde Add install option --no-cache to prevent updating the cache.
e4287d2 Add install option --no-cache to prevent updating the cache.
bsmith bundler (1-0-stable) $ git show 4601dde
commit 4601ddeaaddf2671ecc2baa24f49d9e59e7fcfcb
RegexKit.framework/Headers/RKRegex.h:79:38 Pointer to function type 'NSString *' may not be 'restrict' qualified
// The `define restrict` is there because XCode doesn't want to compile
// RegexKit with the restrict qualifiers.
#define restrict
#import <RegexKit/RegexKit.h>
!!! 5
%html{:lang => 'en'}
%head
%meta{:charset => 'utf-8'}
%title Application
%link{:href => 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css', :rel => 'stylesheet', :type => 'text/css'}
%script{:src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'}
%body
= yield
require "nokogiri"
doc = Nokogiri.XML(IO.read('products.xml'))
@products = doc.xpath("//products/product").map do |p|
{ :product_id => p.css("product_id").text, :product_url => p.css("product_url").text }
end