This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(02:29:18 PM) George Plendl: | |
emphatically i tried to git-discover your moms{snatch+ahole}+1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Comment < ActiveRecord::Base | |
scope :in_public, joins(:post).joins(:category).where("categories.type = 'public'") | |
belongs_to :post | |
end | |
class Post < ActiveRecord::Base | |
has_many :comments | |
belongs_to :category | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 module ActiveRecord | |
2 module Associations | |
3 # Association proxies in Active Record are middlemen between the object that | |
4 # holds the association, known as the <tt>@owner</tt>, and the actual associated | |
5 # object, known as the <tt>@target</tt>. The kind of association any proxy is | |
6 # about is available in <tt>@reflection</tt>. That's an instance of the class | |
7 # ActiveRecord::Reflection::AssociationReflection. | |
8 # | |
9 # For example, given | |
10 # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this assumes you have amixer and notify-send installed: | |
# sudo apt-get install alsa-utils libnotify-bin | |
# this is guaranteed to work on MY system, which is ubuntu | |
# 11.04 with pulseaudio (the default). if anything is likely | |
# to change on your system, it's gonna be the name of the | |
# channel you want to affect. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config = lambda {} | |
Schlepp::Db.should_receive(:new) {|&block| block.should eql config } | |
@burden.db &config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
sys = require('sys'), | |
querystring = require('querystring'); | |
// Create the listening server | |
http.createServer(function(request, response) | |
{ | |
sys.puts('Request for ' + request.url); | |
switch (request.url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'schlepp' | |
Schlepp::Burden.new do | |
# all actions performed in this directory | |
cd 'data/' | |
# do the defined actions for every subfolder | |
glob 'catalogs/*' do |dir| | |
# once we've finished up here we're going to create the catalog | |
dir.after do |dir| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
include DataImporting::Importable | |
include Amf::Serialization | |
field :number | |
field :name | |
field :gender | |
field :region |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module B | |
attr_accessor :b_config | |
def get_b_config | |
@config[:b] | |
end | |
def B.extend_object(target) | |
super | |
target.b_config = target.get_b_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regular Hash behavior: | |
irb(main):023:0> a = {"one"=>"aye", "two"=>"bee"} | |
=> {"one"=>"aye", "two"=>"bee"} | |
irb(main):024:0> a.merge(a) {|k,v| 1} | |
=> {"one"=>1, "two"=>1} | |
Crazy HashWithIndifferentAccess behavior: | |
irb(main):025:0> b = ActiveSupport::HashWithIndifferentAccess.new("one"=>"aye", "two"=>"bee") | |
=> {"one"=>"aye", "two"=>"bee"} | |
irb(main):026:0> b.merge(b) {|k,v| 1} |
NewerOlder