Skip to content

Instantly share code, notes, and snippets.

View jonte's full-sized avatar
🍺
Cheers!

Jonatan Pålsson jonte

🍺
Cheers!
View GitHub Profile
@jonte
jonte / js_test.erl
Created January 21, 2011 14:53
Running javascript from Erlang using erlang_js and SpiderMonkey
-module(js_test).
-export([run/0]).
run() ->
erlang_js:start(),
{ok, Port} = js_driver:new(),
ok = js:define(Port, <<"function helloworld(name){return 'Hello, ' + name}">>),
js:call(Port, <<"helloworld">>, [<<"Generic Game Server">>]).
@jonte
jonte / NoDupes.erl
Created January 4, 2011 14:24
Add an entry to a list without causing a dupe
New = 1,
CompleteList = [1,2,3,4,5], % 1 is already in list
NoDupes = [New | lists:delete(New, CompleteList)].
@jonte
jonte / gist:716727
Created November 26, 2010 13:46
Trigger of 'effin doom
DROP TRIGGER CourseOverFlowTrigger;
CREATE TRIGGER CourseOverflowTrigger
INSTEAD OF INSERT ON WaitingListView
REFERENCING NEW AS NewRow
OLD AS OldRow
FOR EACH ROW
DECLARE maxStudents NUMBER;
regedStudents NUMBER;
maxPlacement NUMBER;
numMissingCourses NUMBER;