My Recent Pastes (9 and counting)

Pastes by nkryptic (9 and counting)

Below are the 9 most recent pasties by nkryptic.

September 30, 2007
5:05PM EDT
by nkryptic

class User << ActiveRecord::Base

  def self.active( options={} )
    with_options :conditions => 'users.active > 0' do |this|
      this.find( :all, options )

September 30, 2007
4:31PM EDT
by nkryptic

## helpers/application_helper.rb

  def header_photo(filename)
    content_for 'header_photo' do <<-CSS_STYLE
      <style type="text/css">

September 30, 2007
3:01PM EDT
by nkryptic

## A new project - first time...

$ cd ~
$ svn co http://svn.rubyonrails.org/rails/trunk edge-rails-checkout
$ ruby edge-rails-checkout/railties/bin/rails my_new_project

January 10, 2007
5:20AM EDT
by nkryptic

## phase 3 (by technoweenie from http://pastie.caboo.se/32063)
# Now the incoming/outgoing methods are on item, so you can do:
#
#   Item.incoming(:all, :order => 'created_at desc', :limit => 15)
#

December 04, 2006
4:30AM EDT
by nkryptic

class User
  has_many :sellers, :include => [:offers]
end

November 29, 2006
4:53AM EDT
by nkryptic

## User model (your table D)
class User < ActiveRecord::Base
  has_many    :friendships, :foreign_key => :fan_id, :class_name => "Friendship", :dependent => :destroy
  has_many    :fanships, :foreign_key => :friend_id, :class_name => "Friendship", :dependent => :destroy
  has_many    :friends, :through => :friendships

November 29, 2006
3:09AM EDT
by nkryptic

## User model
class User < ActiveRecord::Base
  has_many    :friendships, :foreign_key => :fan_id, :class_name => "Friendship", :dependent => :destroy
  has_many    :fanships, :foreign_key => :friend_id, :class_name => "Friendship", :dependent => :destroy
  has_many    :friends, :through => :friendships

November 29, 2006
2:22AM EDT
by nkryptic

desc "Drop then recreate the dev database, migrate up, but no fixtures loaded.  Use UP=n to only remigrate to that version" 
task :remigrate => :environment do
  puts "must be run in development environment" and return unless RAILS_ENV == 'development'
  ActiveRecord::Base.connection.recreate_database ActiveRecord::Base.connection.current_database
  ActiveRecord::Base.connection.reconnect!

November 26, 2006
10:53PM EDT
by nkryptic

var myPeriodical = ''
function stopTimer() {
        if (myPeriodical != '') {
                myPeriodical.stop();
                myPeriodical = ''