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 Code | |
def initialize(person) | |
@person = person | |
end | |
def make_bugs | |
"#{@person.name} does some typing" | |
end | |
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
backend facebookforcats { | |
.host = "localhost"; | |
.port = "3000"; | |
} |
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
module HTTParty | |
def self.included(base) | |
base.extend ClassMethods | |
#snip | |
base.instance_variable_set("@default_options", {}) | |
end | |
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 Thingy | |
include HTTParty | |
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 Search | |
class << self | |
def where(args) | |
Search.new(args) | |
end | |
end | |
def initialize(args) | |
@search_arguments = args | |
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
##AR 2 | |
Person.find(:all, :conditions => {:name => "Joe", :is_admin => true}, :limit => 10) | |
##=> Array | |
#AR 3 | |
Person.where(:name => 'joe', :is_admin => true).limit(10) | |
##=> ActiveRecord::Relation |
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
#Usage: | |
# Awesome.configure do |a| | |
# a.magic_number = 3 | |
# end | |
module Awesome | |
class << self | |
attr_accessor :configuration | |
def config | |
self.configuration ||= Configuration.new |
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 = context[@attributes['source']] if context.has_key? @attributes['source'] |
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
#{{ some_text | truncate: 20, '' }} | |
def truncate(input, length = 50, truncate_string = "...") | |
if input.nil? then return end | |
l = length.to_i - truncate_string.length | |
l = 0 if l < 0 | |
input.length > length.to_i ? input[0...l] + truncate_string : input | |
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
{% assign name = 'bar' %} | |
{% if name == 'bar' %} | |
{{name}} | |
{%endif%} |