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
gem 'cover_me', '>= 1.0.0.rc6', :group => :test |
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
gem 'cover_me', '>= 1.0.0.rc6', :group => :test |
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
# Source: | |
# http://blog.madebydna.com/all/code/2010/06/04/ruby-helper-to-cleanly-truncate-html.html | |
require "rubygems" | |
require "nokogiri" | |
module TextHelper | |
def truncate_html(text, max_length, ellipsis = "...") | |
ellipsis_length = ellipsis.length |
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
ENV["WATCHR"] = "1" | |
system 'clear' | |
def growl(message) | |
growlnotify = `which growlnotify`.chomp | |
title = "Watchr Test Results" | |
puts message | |
image = message.match(/\s0\s(errors|failures)/) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" | |
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" | |
system %(#{growlnotify} #{options} &) |
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
## | |
# This way a radio location/station can have many cities, countries and continents, e.g. | |
# for a global online radio channel. | |
# | |
# A Radio Location can have just a city or country etc. | |
# | |
class RadioStation | |
belongs_to :radio_location | |
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
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 | |
# |
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
"hello world".to_i(36) | |
=> 29234652 |
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 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 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
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 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
DatabaseCleaner.strategy = :truncation, { :except => %w[ translations ] } |