Skip to content

Instantly share code, notes, and snippets.

View adamgamble's full-sized avatar

Adam Gamble adamgamble

View GitHub Profile
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'dcell'
require 'yaml'
require 'command_line_reporter'
class Filez < Thor
include CommandLineReporter
require 'rubygems'
require 'dcell'
class TimeServer
include Celluloid
def time
"The time is: #{Time.now}"
end
end
module Block
class Associated < Base
def self.associate_many(field_name)
lambda {
field :"#{field_name}_uids", :type => Array, :default => []
define_method :"#{field_name}_uids=" do |arr|
arr.shift if arr.first == '0'
Rails.logger.warn "************************** TEST"
super(arr.collect {|uid| uid.kind_of?(BSON::ObjectId) ? uid : BSON::ObjectId(uid)})
<a class="send" href="mailto:?body=&lt;a href=&quot;http://www.ncr.com/documents/This_is_the_best_powerpoint.ppt&quot;&gt;This_is_the_best_powerpoint.ppt&lt;/a&gt;">Send</a>
def self.is_breaking_news? object
where("breaking_newsable_type = ? AND breaking_newsable_id = ?", object.class.to_s, object.id).first
end
object @prospect
attributes :height, :weight
code :image do |p|
{:large => root_url.chop + p.image.url(:large), :thumb => root_url.chop + p.image.url(:thumb)}
end
code :primary_position do |p|
p.primary_position.try(:name)
end
class Api::V1::ProspectsController < Api::V1::BaseController
respond_to :json, :xml
def show
@prospect = Prospect.find(params[:id])
respond_with @prospect
end
end
class Me
end
development:
enable_star: 1
min_infix_len: 1
production:
enable_star: 1
min_infix_len: 1
class Object
def to_bool
if pretentious
if self
return true
else
return false
end
else
!!self