Skip to content

Instantly share code, notes, and snippets.

$ npm install -g dev
> [email protected] install /home/Wizek/local/node-0.4.7/lib/node_modules/dev/node_modules/inotify
> node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Object.defineProperty(Object.prototype, '_proto',
{ enumerable: false
, writable: true
, value: function(name, fn) {
Object.defineProperty( this.prototype, name,
{ enumerable: false
, writable: true
, value: fn } )
}
}
[core]
symlinks = false
autocrlf = true
[pack]
packSizeLimit = 2g
[help]
format = html
[http]
sslCAinfo = /bin/curl-ca-bundle.crt
// Add lib, models and node_modules to path
var path = require('path')
require.paths.unshift(
path.join(__dirname, '/../lib')
, path.join(__dirname, '/../lib/models')
, path.join(__dirname, '/../node_modules')
)
var hlpr = require('helpers')
, db = require('db')
console.log('main.js loaded')
var requisits = [
'/scripts/jquery-1.5-mod.js'
, '/scripts/underscore-min.js'
, '/scripts/order.js'
, '/scripts/text.js'
, 'qunit.js'
]
function inherits(ctor, base) {
ctor.prototype = Object.create(base);
ctor.prototype.constructor = ctor
return ctor
}
function extend(tgt) { var sources
sources = Array.prototype.slice.call(arguments, 1)
sources.forEach(function(source){
Object.keys(source).forEach(function(key){
tgt[key] = source[key] })})
@Wizek
Wizek / inherit.js
Created June 5, 2011 12:20
Inheritance in JS
/*\
* Sometimes I'm amused by how versatile and expressive JavaScript
* can be when it comes to even the smallest of details at its core;
* like declaring inheritance patterns.
* [Or global variable declaration.](http://goo.gl/iqk1J)
*
* We are here to talk about the former, because other times it's a
* baffling experience to choose the right way.
*
* I've listed 5 ways of performing roughly the same task below.
test("new Entry()", function() {
expect(8)
var obj = {
"id": 1
, "position": 0
, "headline": "headline " + Math.random()
, "body": "body " + Math.random()
}
, html = '<li>'
+ '\r\n <span class="headline">'+obj.headline+'</span>'
Code is protected by copyright?
Code can be used in closed source projects?
Program that uses (incorporates) the software can be sold commercially?
Source to bug fixes and modifications must be released?
Provides explicit patent license?
@Wizek
Wizek / frequency_2.py
Created August 8, 2011 22:33
cmavo frequency counter
def progress(str):
print('Info: '+str)
progress('Initializing...')
import csv
import re
import operator
# Global constants