Skip to content

Instantly share code, notes, and snippets.

View lawrencejones's full-sized avatar

Lawrence Jones lawrencejones

View GitHub Profile
var Track = (function() {
function Track(title, artist) {
this.title = title || 'Untitled';
this.artist = artist || 'Unknown';
}
Track.prototype.toString = function() {
return this.title + ',\t\t' + this.artist;
};
# Given a list V of item values, and W of item weights, where item i
# has value V[i] and weight W[i], find the optimal selection of i to
# sure fill the knapsack of capcity k with fractions of items.
#
# The values are required to be sorted by descending order of value
# per pound, in order to enable a greedy choice.
#
# The sort incurs a cost of O(n log(n)), assuming efficient merge
# sort.
#
> module Ex3FunctionsCodeGenerator where
> import Ex3FunctionsTypes
> import Data.List
-----------------------------------------------------------
Solution for Compilers exercise 3
Paul Kelly Imperial College London 2009
-----------------------------------------------------------
Fill in the gaps...
Anonymous UUID: 9DA07A69-940A-DF72-455D-54DAD821BB68
Wed May 21 22:44:27 2014
panic(cpu 0 caller 0xffffff7fa336bfb0): "GPU Panic: [<None>] 3 0 a0 d9 9 8 0 3 : NVRM[0/1:0:0]: Read Error 0x00000144: CFG 0xffffffff 0xffffffff 0xffffffff, BAR0 0x102c00000 0xffffff81f8d94000 0x0e7150a2, D0, P2/4\n"@/SourceCache/AppleGraphicsControl/AppleGraphicsControl-3.4.35/src/AppleMuxControl/kext/GPUPanic.cpp:127
Backtrace (CPU 0), Frame : Return Address
0xffffff81e307cbe0 : 0xffffff8020e22fa9
0xffffff81e307cc60 : 0xffffff7fa336bfb0
0xffffff81e307cd30 : 0xffffff7fa185a22c
0xffffff81e307cdf0 : 0xffffff7fa1924106
0xffffff81e307ce30 : 0xffffff7fa1b47e54
@lawrencejones
lawrencejones / Jakefile.coffee
Last active August 29, 2015 14:01
Jakefile deployment script
#!/usr/bin/env coffee
# vi: set foldmethod=marker
fs = require 'fs'
path = require 'path'
sSplitter = require 'stream-splitter'
$q = require 'q'
coffee = require 'coffee-script'
spawn = (require 'child_process').spawn
exec = (require 'child_process').exec
@lawrencejones
lawrencejones / server.coffee
Last active August 29, 2015 14:01
Express setup for hot compiling coffee/stylus/jade from a project directory
fs = require 'fs'
path = require 'path'
jade = require 'jade'
stylus = require 'stylus'
express = require 'express'
coffee = require 'coffee-script'
morgan = require 'morgan'
# Create app
app = express()
@lawrencejones
lawrencejones / index.html
Created May 26, 2014 15:26
Simple default value setter for html forms
<html>
<head>
<script type="application/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="application/javascript" src="./vals.js"></script>
</head>
<body>
<form>
<input type="text" default="default val">
</form>
</body>
@lawrencejones
lawrencejones / auth.coffee
Last active August 29, 2015 14:01
Basic auth module for angular
auth = angular.module 'auth'
auth.factory\
( 'Auth'
, [ '$q', '$http', '$window', '$state'
($q, $http, $window, $state) ->
deferred = null
class Auth
@lawrencejones
lawrencejones / express.coffee
Created May 27, 2014 21:21
Small express demo
app = (require 'express')()
app.get '/hello', (req, res) ->
res.send 'world!\n'
app.listen 3000, (err) ->
throw err if err?
console.log 'Server listening at port 3000'
@lawrencejones
lawrencejones / commit-msg
Last active August 29, 2015 14:02
Commit hooks to insert ghi prompt and force issue reference
#!/usr/bin/env coffee
# vi: set filetype=coffee
fs = require 'fs'
ttyFd = fs.openSync '/dev/tty', 'r'
msgFile = process.argv[2]
failed = false
error = 'Error! Please reference git issue!'