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
desc "pings my domain every x mimnutes" | |
task :pings do | |
require 'net/http' | |
require 'uri' | |
Net::HTTP.get URI("http://mikesilvis.com") | |
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
String::titleize = -> | |
titleized = this.split(" ") | |
UNCAPITALIZED = ['a', 'an'] | |
titleized = ( | |
for word, index in titleized | |
if word and word.toUpperCase | |
if word in UNCAPITALIZED && index != 0 | |
word | |
else |
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 YamlParser | |
require 'yaml' | |
def initialize(file) | |
YamlParser.access_methods(YAML.load(file)) | |
end | |
def self.access_methods(data) | |
data.each do |key, value| | |
YamlParser.define_method_for_key(key,value) |
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
{ | |
"color_scheme": "Packages/Made of Code.tmTheme", | |
"font_face": "Monaco", | |
"font_size": 16.0, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true | |
} |
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 PhotoSerializer < ActiveModel::Serializer | |
attributes :id, :created_at, :photo_url_thumb, :photo_url_large | |
# Only include these if it is coming from the show action | |
has_many :likes | |
has_many :tags | |
has_many :comments | |
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
def hello_world | |
puts "chris maddox lies" | |
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
if defined? @hello | |
@hello | |
else | |
@hello = "world" | |
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
@hello ||= "world" |
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 = false | |
@hello ||= "world" | |
puts @hello | |
> "world" | |
@hello = false | |
if defined? @hello | |
@hello | |
else | |
"world" |
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
def class_for_cities_deal(deal, opts = {}) | |
@deal_classes ||= {} | |
@hot_count ||= 0 | |
@shared_count ||= 0 | |
collection_size = opts.fetch(:collection_size){ 10 } | |
return @deal_classes[deal.id] if @deal_classes.keys.include?(deal.id) | |
deal_class = case | |
# when deal_in_campaign_and_banner_title?(deal) then "deal_campaign" | |
# when deal.sold_out? then 'sold_out' | |
# when deal.id==top_deal.try(:id) then 'featured_deal' |