Skip to content

Instantly share code, notes, and snippets.

@Emerson
Emerson / example.py
Created October 14, 2015 19:19
example.py
account_params = dict(
name = params['company']['name'],
email = params['from'],
first_name = params.get('first_name', 'First'),
last_name = params.get('last_name', 'Last'),
currency_code = params['currency'],
address = dict(
street1 = params['company']['street'],
city = params['company']['city'],
province = params['company']['state'],
@Emerson
Emerson / all_tweets.rb
Last active August 29, 2015 14:10
Pulling Down a User's Twitter Feed
require 'twitter'
class AllTweets
attr_accessor :tweets
def initialize(username, config)
@username = username
@config = config
@tweets = []
@Emerson
Emerson / .bowerrc
Last active October 20, 2020 13:14
Example Gulpfile used on a legacy WordPress project
{
"directory": "vendor"
}
@Emerson
Emerson / has_relations.rb
Last active August 29, 2015 13:59 — forked from AlexJWayne/has_relations.rb
Rewritten as a Rails concern with updated syntax. Also added a relation_identifier and relation_position that gets dynamically attached to related objects.
module RelationExtensions
extend ActiveSupport::Concern
included do
# -- Constants ------------------------------------------------------------
# -- Attributes -----------------------------------------------------------
attr_accessor :relation_identifier, :relation_position
# -- AR Extensions --------------------------------------------------------
@Emerson
Emerson / Guardfile
Created March 12, 2013 03:51
Example Guard File for Rails 4 and Minitest::Unit
guard 'minitest' do
# with Minitest::Unit
watch(%r|^test/(.*)\/?test_(.*)\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r|^test/test_helper\.rb|) { "test" }
# Rails 4 - App Files
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
<p>blah blah content blah blah - this is shown on the outside</p><!--break-->
<p>inside article content not shown on the front</p>