This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First week of Portland Code School: lessons learned. | |
<ul id=”random-thoughts”> | |
There are only so many hours in the day, pick your battles and make sure | |
have something interesting to ask or bring up for the next day's class. | |
Specifically, DO YOUR HOMEWORK, it will pay off in class when you can actually | |
put the teacher to use. A schedule and notes will help with all of the above. | |
Don’t just voice your questions, voice them so everyone can hear them. | |
It’s really important to over-communicate in a classroom. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FileLoadingApp | |
def call(env) | |
m = nil | |
headers = {'content-type'=>'text/html'} | |
r = Rack::Request.new(env) | |
path = r.path.slice(1, r.path.size) | |
puts path | |
File.open(path, 'rt') do |f| | |
m = [200, headers, [f.read]] | |
puts m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Scrabble | |
# Note I cheated to get the values hash right, | |
# but cool thing is you can use integers as key values, | |
# which comes in handy below. | |
VALUES = { | |
1 => %w{a e i o u l n r s t}, | |
2 => %w{d g}, | |
3 => %w{b c m p}, | |
4 => %w{f h v w y}, | |
5 => %w{k}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/spec' | |
require 'minitest/autorun' | |
require './scrabble.rb' | |
describe Scrabble do | |
describe "word_score" do | |
it "should return 14 if word is Cabbage" do | |
Scrabble.word_score("Cabbage").must_equal 14 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Grandma | |
def initialize | |
@message = ""; | |
end | |
def speak_to(message) | |
if message == "BYE" | |
good_bye | |
return true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def initialize | |
@count = 0; | |
@name = generate_name | |
@mac = generate_name + ":" + generate_name | |
@created_at = Time.now | |
@reset_at = 0 | |
end | |
def generate_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fadeTo: (value, fadeLength)-> | |
fadeLength = fadeLength || @defaultfadeLength | |
currentTime = @ctx.currentTime | |
#time the fade should complete | |
fadeTime = currentTime + fadeLength | |
#set the start time | |
@masterGain.gain.setValueAtTime(@userVolume, currentTime) | |
@masterGain.gain.linearRampToValueAtTime(value, fadeTime) | |
fadeOut: (fadeLength)-> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! Js Pub/Sub | |
* http://anasnakawa.com/ | |
* Copyright (c) Anas Nakawa | |
* inspired by Ben Alman's one <https://gist.github.com/cowboy/661855> | |
* MIT License | |
*/ | |
(function( p ) { | |
var e = p.e = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jasmine.addMatchers({ | |
toBeNearTo: function (utils, customEqualityTesters) { | |
return { | |
compare: function(actual, expected, within) { | |
var diff, | |
result = {}; | |
within = Math.abs(within) || 1; | |
diff = Math.abs(actual - expected); | |
result.pass = diff <= within; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
'use strict'; | |
//var global = require('global'); | |
//var document = require('global/document'); | |
var immstruct = require('immstruct'); | |
var hg = require('mercury'); | |
var h = hg.h; | |
var ctx = new AudioContext(); |
OlderNewer