Skip to content

Instantly share code, notes, and snippets.

Darcy Laycock Sutto

View GitHub Profile
@Sutto
Sutto / about.md
Last active Mar 31, 2016
Buildkite Lambda Function
View about.md

We use this flow with AWS lambda, combined with CloudWatch Scheduled Events, to trigger our builds periodically.

It's nice, avoids duplication and keeps everything together easily.

View encode_to_json.rb
class ApiController < RocketPants::Base
# Override the json encoding mechanism to use Oj for mega-speed!
def encode_to_json(json)
Oj.dump json, mode: :compat
end
add_method_tracer :encode_to_json
end
@Sutto
Sutto / resources.md
Last active Dec 28, 2015
RailsGirls Perth Post-event links
View resources.md

Keeping on Programming

First, there is an incredible breadth of free and paid online coursework you can use to keep going on. The following list are ones we recommend (as does Rails Girls internationally) that cover most topics you need to actually make something:

  • Codecademy is a great series of interactive tutorials designed to teach you the basics of programming.
  • Try Ruby as you've seen is an introduction to the Ruby language - it assumes some general programming concepts, but it's important to understand Ruby and not just Rails (which sits on top of it).
  • Code.org is an incredible program designed to encourage Computer Science among high school students. I highly suggest checking out their video and their learning page - which links to many online resources that have free programming tutorials.
  • Coursera and Udacity are two online university-style teaching places, wit
View boot.rb
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
# Uses forman to boostrap ENV from a .env environment.
# This is mostly useful since it means we can then use it from
# things other than foreman (passenger, our own scripts) with easy.
View hash.rb
# First: Product - Default without setting hash defaults:
x = %w(a b c)
h = Hash[x.product([true])]
p h # => {'a' => true, 'b' => true, 'c' => true}
p h['a'] # => true
p h['d'] # => nil
# e.g: sphinx takes a hash of field name -> weight pairs, so we use
def search_weights
@Sutto
Sutto / code.md
Last active Dec 17, 2015
Our GovHack Source Code
View code.md
View x.m
UILocalNotification *localNotification = [UILocalNotification new];
NSDate *dateToFire = [[NSDate date] dateByAddingTimeInterval:2];
localNotification.fireDate = dateToFire;
localNotification.alertBody = @"Time to update your profile";
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
View gist:4730557
# Darcy's public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAlhcBKPcWKMOVHreqrlSCO5JIKGsmOL30+y/OmqlsbNOHrs0/JpiLpVGowPgAfP02pIjp/GlMFjtfvkgsidXTbkqywZmh45Axh0D5ZmO305N42xTekZ3VJR2x6fn6uZySXrd7GOZIDuQcTsEqsl4wrae1DT66a769RNwYbIRKarBTxlA8C2Zb8I9qvizLg6OV45/Q7vH0TMtQ+3Rfs6GlGJzrbeqH4S8mNzPH9Z9cz2vB+6y0NFBcROT/5xIjFVr0yaKjJiyGOOh/IQZ7aO2pwl/Ozr3vweJ6wTnDCgJ5+5AGLCmzi75JR0f4bEcR+Gt5f4hnOFrOZpM+ppG4Sx4WvQ==
View fix_params.rb
if defined?(ActionDispatch); begin; ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML); rescue; end; end
if defined?(ActionController::Base) && ActionController::Base.respond_to?(:param_parsers); begin; ActionController::Base.param_parsers.delete(Mime::XML); rescue; end; end
if defined?(ActionDispatch); begin; ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::JSON); rescue; end; end
if defined?(ActionController::Base) && ActionController::Base.respond_to?(:param_parsers); begin; ActionController::Base.param_parsers.delete(Mime::JSON); rescue; end; end
@Sutto
Sutto / version_recognizers.rb
Created Nov 26, 2012
Initial RocketPants 2.0 Version Recognition Thoughts
View version_recognizers.rb
class VersionRecognizer
attr_reader :app, :matcher
def initialize(app, matcher)
@app = app
@matcher = compile_matcher(matcher)
end
def extract_version(env)
You can’t perform that action at this time.