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 RubyExample | |
CONSTANT = /^[0-9]+ regex awesomes$/ | |
attr_reader :colorscheme | |
def initialize(attributes = {}) | |
@colorscheme = attributes[:colorscheme] | |
end | |
def self.values |
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 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 |
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 Publishers | |
class HTTP | |
attr_accessor :key | |
attr_reader :hosts | |
def initialize attributes = nil | |
attributes ||= {} | |
self.event = attributes[:event] | |
self.hosts = attributes.fetch(:hosts) do |
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 '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 = [] |
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 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 |
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 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 |
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
// 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(); | |
}, |
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
<!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 { |