My Recent Pastes (51 and counting)

Pastes by hasmanyjosh (51 and counting)

Pages:

Below are the 15 most recent pasties by hasmanyjosh.

June 19, 2008
12:18AM EDT
by hasmanyjosh

class ApplicationController < ActionController::Base
  before_filter :strip_accents

  def strip_accents
    thunk = lambda do |k,v|

March 30, 2008
11:22PM EDT
by hasmanyjosh

# file: bootstrap.rake
# task: rake db:bootstrap
#
# Load initial database state from fixtures in db/bootstrap directory.
# Add subdirectories named for environments to load specific fixtures

January 15, 2008
2:49PM EDT
by hasmanyjosh

{
    "name": "731 Market St San Francisco, CA",
    "Status": {
        "code": 200,
        "request": "geocode"

January 11, 2008
2:35AM EDT
by hasmanyjosh

module Foo
  class Bar
    class Bob < Bar
      def self.hello
        puts self.name

January 10, 2008
2:07PM EDT
by hasmanyjosh

10:30 <someone> haha
10:30 <someone> spammer kept sending me spams about his conference he's having at a resort in  phoenix later this month
10:30 <someone> so i called the conference and said i was him, and was able to successfully  talk them into a cancellation for the whole event
10:31 <someone> i hate spammers

January 06, 2008
7:43PM EDT
by hasmanyjosh

[5:43pm] hasmanyjosh: nzkoz: nick is here. 
[5:43pm] hasmanyjosh: nzkoz: he's taking the kbd now
[5:43pm] nkallen: hi nzkoz
[5:43pm] nkallen: ok so i heard you're interested in the refactoring work i'd like to do to AR
[5:43pm] nkallen: basically I'm working on a prototype - I'll have something to show this weekend. I must warn that what I propose to do is maybe radical and would entail a fair amount of work

January 04, 2008
12:16PM EDT
by hasmanyjosh

### before

  def update
    @article = Article.find(params[:id])
    

December 16, 2007
11:24AM EDT
by hasmanyjosh

# before:

      def to_html
        returning table = '<table>' do
          properties.each do |(name, value)|

December 11, 2007
2:30PM EDT
by hasmanyjosh

      def validates_acceptance_of(*attr_names)
        configuration = { :message => ActiveRecord::Errors.default_error_messages[:accepted], :on => :save, :allow_nil => true, :accept => "1" }
        configuration.update(attr_names.extract_options!)

        db_cols = begin

September 23, 2007
3:17PM EDT
by hasmanyjosh

1. Mechanical Engineering (bolt)
2. Civil Engineering (pickaxe)
3. Architecture (log pile)
4. Civil Engineering (wheel)
5. Environmental Engineering (smokestack)

September 08, 2007
12:24PM EDT
by hasmanyjosh

  # use to check which button on a form was clicked.
  # works for <input type="submit" value="button_name"...> and <input type="image" name="button_name" ...>
  def submit_matches?(name)
    params[:commit] == name.to_s || params.has_key?("#{name}.x")
  end

August 16, 2007
11:59PM EDT
by hasmanyjosh

class Tagging < ActiveRecord::Base
  belongs_to :article
  belongs_to :tag
  
  validates_presence_of     :article_id, :tag_id

August 13, 2007
4:49PM EDT
by hasmanyjosh

class TimePoint < DateTime
  
  attr_accessor :precision
  
  def initialize(ajd, of, sg, prec = :second)

July 18, 2007
11:51PM EDT
by hasmanyjosh

                     user     system      total        real
exists?         16.110000   1.510000  17.620000 ( 24.378860)
exists_opt?     15.050000   1.500000  16.550000 ( 21.901476)
exists_count?   17.930000   1.530000  19.460000 ( 24.787894)

July 18, 2007
11:42PM EDT
by hasmanyjosh

# create schema
class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.string :login

Next page