This file contains hidden or 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
# Facets syntax first draft | |
# Defining | |
define_index do | |
indexes state, :facet => true # use existing field | |
has year, :facet => true # use existing attribute | |
has status_id, :facet => status.name # use existing attribute as key, given field as text | |
facet status.name | |
facet status.name, :id => status.id | |
end |
This file contains hidden or 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
# Current Facets Support: | |
# | |
# Single-model searches only | |
# | |
class Person < ActiveRecord::Base | |
define_index do | |
indexes state, :facet => true | |
has year, :facet => true | |
facet city |
This file contains hidden or 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
Overview of Saul Griffith talk at The Long Now Foundation, written by Stewart | |
Brand: | |
Engineer Griffith said he was going to make the connection between personal | |
actions and global climate change. To do that he's been analyzing his own life | |
in extreme detail to figure out exactly how much energy he uses and what | |
changes might reduce the load. In 2007, when he started, he was consuming | |
about 18,000 watts, like most Americans. | |
The energy budget of the average person in the world is about 2,200 watts. |
This file contains hidden or 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
# Goal is => Client.first.items... Can do with finder_sql, but want an activerecord way! | |
class Client < ActiveRecord::Base | |
has_many :contacts | |
has_many :tasks, :through => :contacts | |
# has_many :items, :through => :tasks # THIS DOESNT WORK | |
def items | |
@items ||= self.tasks.collect { |task| task.items }.flatten | |
end |
This file contains hidden or 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
- filtered_filenames(@items).each do |name| | |
%p do some stuff |
This file contains hidden or 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 'mysql' | |
require 'riddle' | |
require 'trollop' | |
opts = Trollop::options do | |
opt :sql_host, "SQL host", :type => :string | |
opt :sql_user, "SQL username", :type => :string | |
opt :sql_pass, "SQL password", :type => :string | |
opt :sql_db, "SQL database", :type => :string | |
opt :sql_socket,"SQL socket", :type => :string |
This file contains hidden or 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
/Library/Ruby/Gems/1.8/gems/radiant-0.7.1/vendor/rails/railties/lib/initializer.rb:358:in `load_view_paths': private method `load' called for #<String:0x349e118> (NoMethodError) | |
from /Library/Ruby/Gems/1.8/gems/radiant-0.7.1/vendor/rails/railties/lib/initializer.rb:182:in `process' | |
from /Library/Ruby/Gems/1.8/gems/radiant-0.7.1/vendor/rails/railties/lib/initializer.rb:112:in `send' | |
from /Library/Ruby/Gems/1.8/gems/radiant-0.7.1/vendor/rails/railties/lib/initializer.rb:112:in `run' | |
from /Library/Ruby/Gems/1.8/gems/radiant-0.7.1/lib/radiant/initializer.rb:100:in `run' | |
from /Users/pat/Code/ccc/internet/config/environment.rb:12 | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' | |
from /Library/Ruby/Gems/1.8/gems/radiant-0.7.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require' | |
... 23 levels... |
This file contains hidden or 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
curl -L http://github.com/freelancing-god/fakeweb/tarball/matcher -o matcher.tar.gz | |
tar -xvf matcher.tar.gz | |
mv freelancing-god-fakeweb* fakeweb | |
cd fakeweb | |
rake gem | |
sudo gem install pkg/fakeweb-1.3.1.gem |
This file contains hidden or 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 A | |
def initialize | |
dispatch if respond_to?(:dispatch) | |
end | |
end | |
class B < A | |
def dispatch | |
puts "called dispatch" | |
end |
This file contains hidden or 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
def drill(*args) | |
args.inject(nil) do |obj, pointer| | |
obj = obj.nil? ? pointer : obj[pointer] | |
end | |
end | |
@items = build_multilevel_hash | |
drill(@items, :right, :down, :to, :here) |