Skip to content

Instantly share code, notes, and snippets.

View adambray's full-sized avatar

Adam Bray adambray

  • Mechanical Orchard
  • Washington, DC
View GitHub Profile
@adambray
adambray / ga_lesson_plan_template.md
Created January 28, 2015 22:36
Lesson Plan Template Markdown

Delivery Tips:

  • Think about how long you're talking
  • Move quicker sooner, slower later
  • Cold Call more often
  • Revisit LOs
  • Defer questions when appropriate

LESSON TITLE

@adambray
adambray / programming_cockatils.md
Created November 13, 2014 20:25
Programming Cocktails

Programming Cocktails

The Best Ideas (All have been served 'in production')

  • Prototype - An Old Fashioned
  • Gem and Tonic - Gin & Tonic + Grenadine
  • Solarized Light - A Tequila Sunrise, name is a play on a terminal theme.
  • Ruby red - red wine with coke (aka Kalimotxo)
  • Bourbon.css - Bourbon on the rocks
@adambray
adambray / pair_programming_exercises.md
Last active October 21, 2021 14:03
Pair Programming Exercises

Number to Ordinal

See full kata at codewars

Finish the function numberToOrdinal, which should take a number and return it as a string with the correct ordinal indicator suffix (in English). That is:

  • numberToOrdinal(1) ==> '1st'
  • numberToOrdinal(2) ==> '2nd'
  • numberToOrdinal(3) ==> '3rd'
  • numberToOrdinal(4) ==> '4th'
# Notes from following: https://gorails.com/deploy/ubuntu/14.04
# Make sure we're in the home directory of our deploy user
cd /home/deploy
# Create the SSH Directory so we can log in without a password (using a key instead)
mkdir .ssh
cd .ssh/
# This is the file where SSH keeps keys you can log in with for this user
@adambray
adambray / life_after_wdi.md
Created September 16, 2014 20:00
Life After WDI June Closure

Life After WDI

Learning Objectives

  • Understand and explain how to be a great developer

Outline

  • Stay hungry... there's always:
@adambray
adambray / gist:9815242
Created March 27, 2014 18:54
Tunr purchases create action
#
def create
song = Song.find(params[:song_id])
if !current_user.songs.include?(song)
# This line here is failing for some reason.
# I expect to get true or false, but I'm getting a
# nilMethodError.
if current_user.debit(song.price)
@purchase = Purchase.create({
@adambray
adambray / prework_self-assesment.md
Created February 19, 2014 16:23
Pre-work Self-Assesment

Web Development Immersive :: Pre-Work Self-Assessment

INSTRUCTIONS

Please spend around 45 minutes to complete this self-assesment - you may record your answers in this form.

We understand that you may not feel 100% comfortable with all of the topics covered in the pre-work, as many of them are new and challenging. We will cover many of these topics in class during the first two weeks. This will give you a chance to continue learning and apply these concepts & tools to your practice.

Q1

task :prefix_initializer do
prefix_config_file =<<-EOF
Reservations::Application.configure do
config.action_controller.relative_url_root = '/#{application_prefix}'
end
EOF
run "mkdir -p #{shared_path}/config"
put prefix_config_file, "#{shared_path}/config/prefix.rb"
end
@adambray
adambray / incident.rb
Created July 26, 2013 23:47
Sample ruby class with dynamic attributes in a hash.
module SN
class Incident
def initialize(attributes = {})
@attributes = attributes
end
def method_missing(method, args = nil)
method_name = method.to_s
if match = method_name.match(/(.*)=/) # writer method
<!DOCTYPE html>
<html>
<head>
<title>Tickets</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>