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 'net/http' | |
# Original credits: http://blog.inquirylabs.com/2006/04/13/simple-uri-validation/ | |
# HTTP Codes: http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTPResponse.html | |
class ActiveRecord::Base | |
def self.validates_uri_existence_of(*attr_names) | |
configuration = { :message => "is not valid or not responding", :on => :save, :with => nil } | |
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash) | |
configuration[:with] = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix |
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
rvm package install zlib | |
rvm package install iconv | |
rvm package install readline | |
rvm install 1.9.2-head -C --with-readline-dir=$HOME/.rvm/usr --with-iconv-dir=$HOME/.rvm/usr --with-zlib-dir=$HOME/.rvm/usr --with-openssl-dir=/usr/local | |
gem install linecache19 -- --with-ruby-include=/Users/USERNAME/.rvm/src/ruby-1.9.2-VERSION/ | |
gem install ruby_core_source -- --with-ruby-include=/Users/USERNAME/.rvm/src/ruby-1.9.2-VERSION/ | |
gem install ruby-debug-base19 -- --with-ruby-include=/Users/USERNAME/.rvm/src/ruby-1.9.2-VERSION/ |
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 'autotest/growl' | |
Autotest.add_hook :initialize do |at| | |
%w{.svn .hg .git vendor db public log script doc}.each {|exception| at.add_exception(exception)} | |
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
# super class that is stored in the database | |
class Message | |
... | |
end | |
module Linkedin | |
class Message < ::Message | |
... | |
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
# super class that is stored in the database | |
class Message | |
... | |
end | |
class Linkedin::Message < Message | |
... | |
end | |
class Facebook::Message < Message |
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
DatabaseCleaner.strategy = :truncation, { :except => %w[ translations ] } |
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
describe User | |
it "should fetch Linkedin data on create for the profile" | |
it "should fetch Linkedin connections after create" | |
it "should fetch positions after fetch" | |
it "must have a linked in profile" | |
it "must have a linked in uid" | |
it "should be possible to update the data from linked in" | |
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
class Linkedin::Profile < ActiveRecord::Base | |
set_table_name 'linkedin_profiles' | |
belongs_to :user, :class_name => "Linkedin::User" | |
has_many :positions | |
has_many :educations | |
belongs_to :industry | |
belongs_to :location |
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
"hello world".to_i(36) | |
=> 29234652 |
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 Photo < ActiveRecord::Base | |
has_attached_file :image, :styles => { :thumb => ['150x150#', :png], | |
:normal => ['660x660', :png] }, | |
:default_style => :normal | |
typed_serialize :sizes, Hash | |
before_save :cache_image_sizes | |
# Get size of this photo for specified style | |
# |
OlderNewer