Skip to content

Instantly share code, notes, and snippets.

var Twit = require('twit');
var T = new Twit({
consumer_key: '...'
, consumer_secret: '...'
, access_token: '...'
, access_token_secret: '...'
});
var userid = '...';
@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

@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 / 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 / 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'
@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 / 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

class JobSchedule
# External interface for calling the service
def self.call(object_id, opts={})
if perform_asynchronously?
Delayed::Job.enqueue(EnqueuedJob.new(name, object_id, opts))
else
perform(object_id, opts)
end
end
@JackVCurtis
JackVCurtis / SHA1
Created February 20, 2015 18:08
Single block implementation of SHA1 in Ruby. DO NOT USE THIS IN REAL LIFE.
def rot_left(num, count)
bin_string = num.to_s(2)
bin_string = ("0" * (32 - bin_string.length)) + bin_string
shifted_string = bin_string[0..(count-1)]
rotated_string = bin_string[count..31] + shifted_string
return rotated_string.to_i(2)
end
def lsb_32(num)
s = num.to_s(2)
@adambray
adambray / example_lesson.md
Created February 28, 2015 20:23
Example Lesson Plan - Scaffolding

Domain Modeling and Databases

Learning Objectives

  • Describe the basic parts of an ERD
  • Construct ERDs to model the nouns and relationships in a domain
  • Explain what a database is and why you would use one as opposed to other persistent storage mechanisms
  • Explain the difference between a database management system (R/DBMS) and a database, and name the major DBMSes