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:
@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
@RobertAKARobin
RobertAKARobin / w01d01homework.md
Last active August 29, 2015 14:17
w01d01 Homus Workus

Homework, W01D01


Create a function in your .bash_profile that will set up a working directory for a new GA student!

Things it should do:

  • Create a folder called GeneralAssembly
@RobertAKARobin
RobertAKARobin / warmupw01d02.md
Last active August 29, 2015 14:17
Warmup, W01D02

Mission: Impossible!

We, the Impossible Missions Force, have become aware that Doctor Nefarious is planning on using his Nefarious Computer (a standard Macbook) to initiate a nuclear launch sequence that will destroy the entire world.

Our sources have told us that the nuclear launch sequence is run from a shell script, and have also given us a tree showing the contents of the Doctor's computer (the flash drive has been added to show where in the structure it will appear):

NO_NUCLEAR_LAUNCH_SEQUENCES_HERE/
	nopeNotALaunchSequence.sh
TOP_SECRET/
	SERIOUSLY_TOP_SECRET/
<h2 class="catalog"><%= link_to category.name, category_equipment_models_path(category) %></h2>
<ul class="catalog">
<% equipment_models.each do |equipment_model| %>
<li>
<%= (link_to (image_tag equipment_model.photos.first.data.url(:small), :class => 'product_small'), equipment_model.photos.first.data.url, :target => '_blank' ) unless equipment_model.photos.empty? %>
<h3><%= link_to equipment_model.name, equipment_model %></h3>
(<%= equipment_model.available?(cart.start_date..cart.due_date) || "0" %> available from <%= cart.start_date %> to <%= cart.due_date %>)<br />
<%= link_to_remote "[add to cart]", {:url => add_to_cart_path(equipment_model)}, :href => add_to_cart_path(equipment_model) %><br /><br />
</li>
<% end %>
<br style="clear: both" />
<%= render :partial => 'reservations/reservations_sidebar' if current_user %>
<% unless current_user.equipment_objects.empty? %>
<div id="equipment">
<h3>Your current equipment:</h3>
<%= render :partial => 'users/current_equipment', :object => current_user %>
</div>
<% end %>
<%= yield(:right_sidebar) %>
</div>