Skip to content

Instantly share code, notes, and snippets.

View janjongboom's full-sized avatar

Jan Jongboom janjongboom

View GitHub Profile
@janjongboom
janjongboom / hallo.js
Created October 3, 2011 12:37
tes123
alert('hoi');
alert(1+1);
@janjongboom
janjongboom / c9-tralalaala
Created October 4, 2011 09:43
Cloud9 test
// hello this is a test
/// <reference path="jquery-1.4.1.js" />
/*
* jQuery plugin: zoekbox - v1.0.0
* (c) 2010-2011 funda real estate <jan@funda.nl> - http://www.funda.nl
*
* This is the core library for EVERYTHING that uses the zoekbox;
* either geo, nieuwbouw-projects, or even the names of all funda employees
* therefore NEVER EVER add anything that is implementation-specific to this code.
*
@janjongboom
janjongboom / abc
Created October 5, 2011 09:56
dit is een test
Hoi not authenticated
@janjongboom
janjongboom / file2.js
Created October 6, 2011 11:16
my awesome multifile gist
var fileNo = 2;
if (fileNo === 2) {
console.log('oh noes, its numero deux!');
}
@janjongboom
janjongboom / chat-server.js
Created October 6, 2011 13:57
NodeJs samples
HOST = null; // localhost
PORT = 8001;
// when the daemon started
var starttime = (new Date()).getTime();
var mem = process.memoryUsage();
// every 10 seconds poll for the memory.
setInterval(function () {
mem = process.memoryUsage();
@janjongboom
janjongboom / gist:1818774
Created February 13, 2012 18:15
Inheritance
var sys = require("sys");
var pg = require("pg");
var connStr = "tcp://postgres:admin@localhost:5432/c9_businessrules"; // @todo: to config
var entities = {
product: require("./entities/product"),
contract: require("./entities/contract"),
delivery: require("./entities/delivery"),
contractType: require("./entities/contracttype"),
log_contract: require("./entities/log_contract"),
function MyObject () {
// do stuff
}
// now to export this as a nodejs module do
module.exports = MyObject;
// =====
// in another file (in the same folder) you can now do
@janjongboom
janjongboom / gist:1977769
Created March 5, 2012 10:24
find activities c9 redis
"use strict";
var Search = require("c9/dispatcher/search");
module.exports.hotfix = function(config, infraredis, searchredis) {
Search.setDatabases(infraredis, searchredis);
var start = 0, end = 106000;
var aids = []
for (var i = start; i <= end; i++) {
@janjongboom
janjongboom / gist:2508732
Created April 27, 2012 12:18
isEven function for javascript
// efficient isEven function
// you can insert a number or a string, doesn't matter
// it doesn't take numbers after the dot into account because noone uses them anyways
// it's also very handy for shopping websites because you can do
// isEven("$ 31.00") and it will say 'not even'.
// or isEven("32.00 $") and will say 'even'
function isEven(a) {
   a = a.toString().replace(/[^0-9.]/g, "");
   var stack = [];
   var rev = a.split('').reverse();
"no use strict";
var console = {
log: function(msg) {
postMessage({type: "log", data: msg});
}
};
var window = {
console: console
};