Skip to content

Instantly share code, notes, and snippets.

@developish
developish / user.rb
Created November 9, 2010 01:43
How to use authogic without requiring a password
class User < ActiveRecord::Base
acts_as_authentic do |config|
config.validate_password_field :if => :require_password_on_signup?
end
def require_password_on_signup?
false
end
end
@developish
developish / postal-code-search.rb
Created May 22, 2010 23:26
Simple postal code search using the Geonames web service
require 'rubygems'
require 'geonames' # ppe-ruby-geonames
class PostalCodeSearch
include Geonames
def initialize(postal_code, country_code = "US")
@postal_code = postal_code
@country_code = country_code
@response = nil
@developish
developish / example.rb
Created January 7, 2010 15:09
How to use searchlogic and geokit together
@zipcode = Zipcode.find_by_name("85023")
# Passing in a hash of search parameters is more convenient for my purposes,
# but searchlogic allows the second, chained method of searching also works.
@locations = Location.by_location(:origin => @zipcode, :within => 10).search(:name_like => "searchlogic", :city_is => "Phoenix")
@locations = Location.by_location(:origin => @zipcode, :within => 10).name_like("searchlogic").city_is("Phoenix")
@developish
developish / gist:200489
Created October 3, 2009 08:04
email-with-pony.rb
require "rubygems"
gem "hiroshi-pony"
require "pony"
Pony.mail({
:to => "brandon@developish.com",
:subject => "subject",
:body => "body",
:via => :smtp, :smtp => {
:host => 'smtp.gmail.com',