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 StringJoiner | |
def call string1, string2 | |
"#{string1}#{string2}" | |
end | |
end | |
join = StringJoiner.new | |
join.call("this ", "is normal") | |
# => "this is normal" |
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
# Open a project interactively | |
unbind C-p | |
bind-key C-p \ | |
command-prompt -p "client:","project:" "\ | |
new-session -A -c ~/Projects/%1/%2 -s %2 -n code 'reattach-to-user-namespace -l vim'\;\ | |
new-window -d -n console 'tail -f log/development.log'\;\ | |
split-window -v -t 1 'rails c'\;\ | |
next-window" |
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
Started GET "/products/die-cut-stickers" for 127.0.0.1 at 2014-11-19 12:47:59 -0500 | |
Processing by Spree::ProductsController#show as HTML | |
Parameters: {"id"=>"die-cut-stickers"} | |
Spree::Preference Load (0.4ms) SELECT "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = 'spree/frontend_configuration/locale' LIMIT 1 | |
Spree::User Load (0.3ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."id" = 1 ORDER BY "spree_users"."id" ASC LIMIT 1 | |
Spree::Store Load (0.3ms) SELECT "spree_stores".* FROM "spree_stores" WHERE (url like '%rockin-stickers.dev%') ORDER BY "spree_stores"."id" ASC LIMIT 1 | |
Spree::Store Load (0.3ms) SELECT "spree_stores".* FROM "spree_stores" WHERE "spree_stores"."default" = 't' ORDER BY "spree_stores"."id" ASC LIMIT 1 | |
Spree::Order Load (0.4ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."completed_at" IS NULL AND "spree_orders"."currency" = 'USD' AND "spree_orders"."guest_ |
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
require 'builder' |
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 is a gist |
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
# Create the associations for individual body_metrics and accept their nested | |
# attributes. This makes the biometrics form work and a few other things. | |
Dir['app/models/body_metric/*.rb'].collect { |file| File.basename(file).sub /\.rb/, '' }.each do |metric| | |
has_one :"current_#{metric}", -> { latest }, class_name: "BodyMetric::#{metric.camelize}" | |
accepts_nested_attributes_for :"current_#{metric}" | |
define_method("current_#{metric}") do | |
super() || self.send(:"build_current_#{metric}") | |
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 Policy | |
attr_reader :expires, :response | |
def initialize user | |
if user | |
@expires = 8.hours.from_now | |
content_length = 100..50.megabytes | |
user_id = user.email.split('@').reverse.join('/') | |
else | |
@expires = 30.minutes.from_now |
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 Shortwave | |
module Observable | |
def self.included(base) | |
base.send :include, InstanceMethods | |
end | |
module InstanceMethods | |
class Notification | |
attr_accessor :event, :id, :klass |
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
ack | |
autoconf | |
automake | |
cmake | |
cowsay | |
curl-ca-bundle | |
ec2-api-tools | |
fortune | |
fping | |
freetype |
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 create_stylesheet | |
stylesheet = StringIO.new | |
stylesheet << <<-EOS | |
@font-face { | |
font-family: 'badges'; | |
src: url('#{font_eot.url}'); | |
src: url('#{font_eot.url}') format('embedded-opentype'), | |
url('#{font_woff.url}') format('woff'), | |
url('#{font_ttf.url}') format('truetype'), | |
url('#{font_svg.url}') format('svg'); |
NewerOlder