Skip to content

Instantly share code, notes, and snippets.

@drewlesueur
drewlesueur / estimate.coffee
Created November 19, 2010 23:14
hours estimator helper
a = t()
low = 0
high = 0
a.replace /^[\d]+\-[\d]+ hours/mig , (hours) ->
#console.log hours
hours = hours.split " "
hours = hours[0]
hours = hours.split "-"
low += hours[0] - 0
high += hours[1] - 0
@drewlesueur
drewlesueur / mcm.coffee
Created November 23, 2010 05:12
Algorithms homework :(
mcm = (p) ->
console.log "test"
m = []
s = []
n = p.length - 1
$(document.body).css "height", "20000px"
table = ["<table id='mcm' cellpadding=0 cellspacing=0 style='border-collapse: collapse; -webkit-transform: rotate(135deg) translate(-100px, -300px); '>"]
for a in [1..n]
table.push "<tr colspan='a'>"
for b in [1..a]
@drewlesueur
drewlesueur / lcs.coffee
Created November 23, 2010 08:38
Algorightms homework :(
lcs_length = (x,y) -> #1 indexed arrays
m = x.length - 1
n = y.length - 1
c = []
b = []
for i in [0..m]
c[i] = []
b[i] = []
c[i][0] = 0
for j in [1..n]
@drewlesueur
drewlesueur / iphone_audio_tag.coffee
Created November 23, 2010 11:34
example coffeescript for iphone audio tag
$(document).ready () ->
#alert screen.height
audioElement = document.createElement('audio');
audioElement.setAttribute 'src', 'audio/star_good.m4a'
audioElement.addEventListener 'canplay', () ->
alert 'canplay'
audioElement.controls = false
document.body.appendChild audioElement
audioElement.oncanplay = () ->
console.log "can play"
@drewlesueur
drewlesueur / learning.cpp
Created November 24, 2010 11:37
learning c++
#include <iostream>
using namespace std;
typedef struct record{
int key;
int data;
} record;
record* new_record() {
record *ret;
@drewlesueur
drewlesueur / cse310_proj2.cpp
Created November 24, 2010 12:51
my cse310 assignment
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
typedef struct record{
int key;
int data;
@drewlesueur
drewlesueur / JavaScript_Wishlist.markdown
Created November 25, 2010 17:24
JavaScript Wishlist

Javascript wishlist

@drewlesueur
drewlesueur / lang.coffee
Created November 29, 2010 19:59
Language experiment
# link with an extra property .__meta
# or each object has a .__uid that links
# if you are going to have an extra property anyway, why not make it the meta property.
meta = {}
get = (scope, variable) ->
if scope.__meta.get?
return scope.__meta.get scope, variable
else
return scope[variable]
@drewlesueur
drewlesueur / hello_object.go
Created December 5, 2010 10:31
The hello world of Object Oriented Prorgramming in Go
// run this code at http://golang.org/
package main
import "fmt"
type Person struct {
age int
name, fav_band string
}
@drewlesueur
drewlesueur / polymorphism_go.go
Created December 7, 2010 05:31
polymorphism in go
//the terms "late binding", "dynamic binding", "polymorphism" kind of blur together for me
//here is an example of this concept in Go
package main
import "fmt"
type Animal interface {
Say()