Skip to content

Instantly share code, notes, and snippets.

##The Search for Obi-Wan

C-3PO is a well-known protocol droid from the Star Wars universe, famed for having a frantic resolve and for directing snappy emotional outbursts at his droid life-mate, R2-D2. Your task is to write a program modelling a simple interaction with C-3PO as he searches for the reclusive Jedi Master, Obi-Wan Kenobi.

NOTE: This lesson not only reinforces, but also builds upon what you learned yesterday, so you will likely have to Google a certain bit of Ruby syntax.

  1. Create a new Ruby file called searching_for_obi_wan.rb in your work folder.
  2. C-3PO should:
    • introduce himself as "C-3P0, human-cyborg relations."
  • ask the user's name
class Apartment
@@all = []
def initialize
@@all << self
end
def self.count
@@all.length
end
end
@jshawl
jshawl / warmupw01d02.md
Last active August 29, 2015 14:17 — forked from RobertAKARobin/warmupw01d02.md
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/
grid = [
[0,0,0],
[0,0,0],
[0,0,0]
]
ships = [
[ [0,0],[0,1] ],
[ [1,2],[2,2] ]
]
@jshawl
jshawl / 2015-04-13.md
Last active August 29, 2015 14:19
A Markdown Rendered Gist for Duncan

Level 1

  • an unordered
  • list here
  • should probably autocomplete

Level 2

  1. An ordered list
  2. Where da styles at

Common Rails Commands

rake db:create

  • Creates all the databases specified in config/database.yml

rake db:migrate

  • Run existing migrations in db/migrate
  • Generates the schema.rb file
// TrilloView
// create new cards
// handle form submission
// put existing cards into
// either done or todo lists.
// Trillo Object
// stores a reference to
// all cards
//
// Story.swift
// MashItUp
//
// Created by Jesse Shawl on 5/5/15.
// Copyright (c) 2015 Jesse Shawl. All rights reserved.
//
import UIKit
var express = require("express")
var app = express()
app.get("/", function( req, res ){
res.send("Hello world! <a href='/jesse'>Say Hi to Jesse</a>")
})
app.get("/:name", function( req, res ){
res.send("Hello "+ req.params.name +"!")
})
@jshawl
jshawl / solution-oop.py
Created May 27, 2015 13:18
Python FizzBuzz
class FizzBuzz:
def __init__(self,num):
self.count(num)
def count(self,num):
if num >= 1:
self.count(num - 1)
self.fizz_buzz(num)
def fizz_buzz(self,num):