Public Gists by maxim

Gravatar
Mon Nov 02 23:47:50 -0800 2009
1
2
3
class ActionController::TestCase
  # setup :mock_warden
  teardown :cleanup_warden_env
gist: 223992 gem update fail
Gravatar
Sun Nov 01 22:12:48 -0800 2009
1
2
3
projects/lab/freight[devise]% sudo gem update rr
Password:
Updating installed gems
Gravatar
Fri Oct 30 14:45:27 -0700 2009
1
2
3
  def title(page_title, show_title = true)
    content_for(:title) { t('.title', :default => page_title) }
    @show_title = show_title
Gravatar
Thu Sep 17 19:23:29 -0700 2009
1
2
3
context "with associations" do
  setup do
    fake_association = Struct.new(:macro, :name, :object)
Gravatar
Thu Sep 17 14:29:41 -0700 2009
1
2
3
context "with associations" do
  setup do
    fake_association = Struct.new(:macro, :name, :object)
Gravatar
Tue Sep 15 18:50:26 -0700 2009
1
2
3
def has_role?(role, object)
  if object.has_association?(role)
    if has_many?
Gravatar
Sat Sep 12 17:34:49 -0700 2009
1
2
3
# Install
#
# Move this file into config/preinitializer.rb
gist: 185746 Rake tasks for managing git...
Gravatar
Sat Sep 12 00:25:06 -0700 2009
1
2
3
# Rake tasks for managing git plugins with submodules.
#
# These tasks aim to make life simpler by automating all the boring work.
Gravatar
Thu Sep 03 19:00:14 -0700 2009
1
2
3
  def sample_file(name = "most_used_file.png")
    File.new("test/fixtures/files/#{name}")
  end
Gravatar
Sun Jul 26 10:48:00 -0700 2009
1
2
3
# When you have duplication like this
 
def base_price(options = {})
Gravatar
Wed Jul 08 23:11:37 -0700 2009
1
2
3
# Weird ruby behavior
 
>> class Foo; end
Gravatar
Tue Jul 07 19:57:33 -0700 2009
1
2
3
# On include we're grepping method baz from instance methods
module Foo
  def self.included(base)
Gravatar
Sat Jun 20 23:21:32 -0700 2009
1
2
3
#!/usr/bin/env ruby
 
# tester_elf simply autoruns a ruby test file when you save it.
Gravatar
Sun Apr 12 00:23:56 -0700 2009
1
2
3
  desc "Load SQL structure into database"
  task(:load => :environment) do
    conf = ActiveRecord::Base.configurations
Gravatar
Sun Apr 12 00:20:20 -0700 2009
1
2
3
  desc "Removes all tables from the current database"
  task(:wipe => :environment) do
    conf = ActiveRecord::Base.configurations
Gravatar
Fri Mar 13 14:56:34 -0700 2009
1
2
3
# MODEL
class Vocabulary < ActiveRecord::Base
  has_many :terms, :dependent => :destroy
Gravatar
Mon Mar 09 10:46:24 -0700 2009
1
2
3
require 'w3c_validators'
 
module ShouldPassW3cValidationMacros
Gravatar
Fri Feb 27 16:48:25 -0800 2009
1
2
3
#!/usr/bin/env ruby
#
# usage: script/server_restarter
Gravatar
Wed Feb 11 00:35:27 -0800 2009
1
2
3
    def json_to_png_file(*args)
      returning StringIO.new(Jaxer.json_to_png(*args)) do |s|
        s.content_type = "image/png"
Gravatar
Sun Feb 08 08:52:09 -0800 2009
1
Parameters: {"commit"=>"Create", "action"=>"create", "authenticity_token"=>"xIhGb/nKQfrrKzaJ/J2iQOrupN+81AfreutXOdIoNqY=", "controller"=>"prototypes", "prototype"=>{"title"=>"Fluffy", "surface_views_attributes"=>{"new_1"=>{"picture"=>#<File:/tmp/RackMultipart.99814.5>}, "new_2"=>{"description"=>"back", "picture"=>#<File:/tmp/RackMultipart.99814.6>}, "new_3"=>{"description"=>"", "picture"=>nil}}, "item_view_attributes"=>{"picture"=>#<File:/tmp/RackMultipart.99814.4>}}}