Skip to content

Instantly share code, notes, and snippets.

class RubyExample
CONSTANT = /^[0-9]+ regex awesomes$/
attr_reader :colorscheme
def initialize(attributes = {})
@colorscheme = attributes[:colorscheme]
end
def self.values
@tatey
tatey / option_a.rb
Created October 19, 2012 04:46 — forked from coop/option_a.rb
class Page < ActiveRecord::Base
has_attached_file :image, sizes: {small: '10x10', large: '100x100'}
has_attached_file :uploaded_image
def safe_image_url
if image
image_url
else
'spinner.gif'
end
@tatey
tatey / after.rb
Created August 21, 2012 10:58 — forked from coop/after.rb
module Publishers
class HTTP
attr_accessor :key
attr_reader :hosts
def initialize attributes = nil
attributes ||= {}
self.event = attributes[:event]
self.hosts = attributes.fetch(:hosts) do
require 'test_helper'
class PayPalExpress::TransactionSearchTest < ActiveSupport::TestCase
test "#search returns a collection of transactions" do
account = MiniTest::Mock.new
period = MiniTest::Mock.new
requester = MiniTest::Mock.new
params = {}
params['ACK'] = 'Success'
params.default = []
def get_options(args)
args.inject({}) do |args, arg|
if arg =~ /^--(\S+)$/
key, value = $1.split('=')
args[key] = value.nil? || value
elsif arg =~ /^-(no-?)(\S+)/
if $1 == "no-"
args[$2] = false
else
args[$1] = true
def get_options(args)
args.inject({}) do |args, arg|
if arg =~ /^--(\w+)/
key, value = $1.split('=')
args[key] = value
elsif arg =~ /^-(\w+)/
options[$1.match(/(\w+)$/)[1]] = !$1.match(/^no-/)
end
args
end
// Set API Key
var flickr = $.flickr('123');
// Request instance by invoking flickr service method
var recent = flickr.photos.getRecent({
size: 's'
page: 1,
beforeSend: function() {
$('img#waiting').fadeIn();
},
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>IE float bug</title>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
<style type='text/css'>
body {
font-family: Helvetica, sans-serif; }
#container, #left, #right1, #right2 {