Skip to content

Instantly share code, notes, and snippets.

View pat's full-sized avatar
🇵🇸
free Palestine 🇵🇸

Pat Allan pat

🇵🇸
free Palestine 🇵🇸
View GitHub Profile
module Foo
class A
end
end
puts Foo.constants.inspect # => ["A"]
m = Module.new
m.const_set("B", Class.new)
puts m.constants.inspect
pat@freelancing-god.local [21:27:01] ~/Code/ccc/internet
=( # script/generate
/Library/Ruby/Gems/1.8/gems/radiant-0.6.9/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method': undefined method `loadable_constants_for_path' for class `ActiveSupport::Deprecation::DeprecatedConstantProxy' (NameError)
from /Library/Ruby/Gems/1.8/gems/radiant-0.6.9/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain'
from /Library/Ruby/Gems/1.8/gems/radiant-0.6.9/lib/plugins/dependencies_fix/init.rb:5:in `evaluate_init_rb'
from /Library/Ruby/Gems/1.8/gems/radiant-0.6.9/lib/plugins/dependencies_fix/init.rb:1:in `class_eval'
from /Library/Ruby/Gems/1.8/gems/radiant-0.6.9/lib/plugins/dependencies_fix/init.rb:1:in `evaluate_init_rb'
from /Library/Ruby/Gems/1.8/gems/radiant-0.6.9/vendor/rails/railties/lib/rails/plugin.rb:95:in `evaluate_init_rb'
from /Library/Ruby/Gems/1.8/gems/radiant-0.6.
pat@freelancing-god.local [22:54:15] ~/Code/ccc/internet
=) # rake db:migrate --trace
(in /Users/pat/Code/ccc/internet)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
development:
enable_star: true
min_prefix_len: 1
port: 3312
test:
enable_star: true
min_prefix_len: 1
port: 3313
# quick raspell example
require 'raspell'
speller = Aspell.new("en_US")
speller.suggestion_mode = Aspell::NORMAL
speller.check("threory") #=> false (ie: misspelt)
speller.suggest("threory").first #=> "theory"
speller.suggest("threory") #=> ["theory", "thready", "therefor", "throaty", "throe", "three", "therefore", "Rory", "Theron", "theory's", "throed", "throes", "theorem", "thereby", "thereof", "thereon", "threat", "threes", "throat", "there", "threw", "throw", "therapy", "throb", "throe's", "thievery", "dreary", "priory", "thread", "thresh", "throne", "thrown", "throws", "three's", "thruway", "they're"]
Event.search("dolorem",
:with => {:start_date => 1.year.from_now..Time.now},
:order => :start_date
)
@pat
pat / gist:43460
Created January 5, 2009 16:57 — forked from headius/gist:43347
RubyConf
RailsConf
RailsConf EU
acts_as_conference
Euruko
Ruby Kaigi
Mountain West RubyConf
eRubyCon
Ruby Hoedown
Amsterdam Ruby en Rails
*UPDATE*: I've received several offers of help. You can still offer if you
want, but I think I've got enough people to get this done. Thank you :)
Request for Server Assistance
I need a server set up for some pro-bono projects. Server management is not my
area of expertise, so I'd love if someone else could manage this, but if not, I
guess I'll figure it out myself. Yes, this is not paid work. The clients are
NGOs though, if that makes it more palatable.
class User < ActiveRecord::Base
define_index do
indexes description
has id
end
end
>> User.create(:id=> 555,:description => "test").save
>> User.create(:id=> 556,:description => "test").save
>> User.create(:id=> 557,:description => "test").save
# 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