Public Gists by mdarby

Gravatar
Mon Jan 26 19:38:33 -0800 2009
1
alias gl='git log --graph --pretty=format:"%Cred%h%Creset — %s %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'
Gravatar
Fri Jan 23 04:22:05 -0800 2009
1
2
3
class Task < ActiveRecord::Base
  logical_parent :project
 
Gravatar
Wed Jan 14 18:00:16 -0800 2009
1
2
3
--------------
    1/1 ActionView::Renderable#_unmemoized_handler
      1 ActionView::TemplateHandlers#handler_class_for_extension
Gravatar
Tue Jan 13 14:23:30 -0800 2009
1
2
3
# polls_helper.rb
module PollsHelper
 
Gravatar
Tue Jan 13 14:23:05 -0800 2009
1
2
3
# option_form.html.haml
.option
  %input{ :name => "poll[options][]", :value => option }
Gravatar
Tue Jan 13 14:22:44 -0800 2009
1
2
3
# new.html.haml
- form_for(@poll) do |f|
  = box("Candidates") do
Gravatar
Tue Jan 13 14:21:52 -0800 2009
1
2
3
# poll.rb
class Poll < ActiveRecord::Base
  serialize :options
Gravatar
Wed Jan 07 12:48:54 -0800 2009
1
2
3
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
Gravatar
Sun Jan 04 08:53:43 -0800 2009
1
2
3
  def list
    @objects = Hash.new
    Object.find(:all).each { |r|
Gravatar
Sun Jan 04 08:52:07 -0800 2009
1
2
3
orderBy($arr, 'Second Element', 'DESC');
 
// Output:
Gravatar
Sun Jan 04 08:51:12 -0800 2009
1
2
3
$arr = array();
 
$arr[0] = array(
Gravatar
Sun Jan 04 08:50:40 -0800 2009
1
2
3
function orderBy(&$data, $field, $direction){
//Provide the anonymous recursive functionality
$code = "return strnatcmp(\$a['$field'], \$b['$field']);";
Gravatar
Sun Jan 04 08:48:44 -0800 2009
1
User.update(121, {:last_login => Time.now})
Gravatar
Sun Jan 04 08:48:21 -0800 2009
1
2
3
// Load User from the database
$user = $this->User->findById(121);
 
Gravatar
Sun Jan 04 08:46:34 -0800 2009
1
2
3
$ ARCHFLAGS="-arch i386"
$ ruby extconf.rb --with-mysql-dir=/usr/local/mysql
$ make
Gravatar
Sun Jan 04 08:43:19 -0800 2009
1
2
3
it "${0:should ${1:description}}" ${3:do
  ${2:pending("Needs to be written")}
end}
Gravatar
Sun Jan 04 08:41:33 -0800 2009
1
2
3
A Car
  should have a color
  should not be driveable with one tire
Gravatar
Sun Jan 04 08:40:08 -0800 2009
1
2
3
describe "A Car" do
  before(:each) do
    @car = mock_model(Car)
Gravatar
Sun Jan 04 08:37:09 -0800 2009
1
date.strftime("%B #{date.day.ordinalize}, %Y")
Gravatar
Sun Jan 04 08:35:42 -0800 2009
1
git clone git://github.com/mdarby/restful_acl.git