Skip to content

Instantly share code, notes, and snippets.

Tate Johnson tatey

Block or report user

Report or block tatey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ruby_example.rb
class RubyExample
CONSTANT = /^[0-9]+ regex awesomes$/
attr_reader :colorscheme
def initialize(attributes = {})
@colorscheme = attributes[:colorscheme]
end
def self.values
View 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
View 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
View gist:2557125
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 = []
View gist:325083
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
View gist:325073
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
View gist:297142
// 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();
},
View IE7 negative margin float bug WTF.html
<!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 {
You can’t perform that action at this time.