Skip to content

Instantly share code, notes, and snippets.

View carlosvillu's full-sized avatar
🏠
Working from home

Carlos Villuendas Zambrana carlosvillu

🏠
Working from home
View GitHub Profile
@carlosvillu
carlosvillu / better-console-log.js
Last active September 1, 2015 13:28 — forked from RReverser/better-console-log.js
Better console.log in Node
// UPD:
// Now available as npm module!
// Check out https://github.com/RReverser/better-log for details.
console.log = (function (log, inspect) {
return function () {
return log.apply(this, Array.prototype.map.call(arguments, function (arg) {
return inspect(arg, { depth: 1, colors: true });
}));
};
@carlosvillu
carlosvillu / extend.js
Created November 15, 2012 10:44 — forked from tcorral/extend.js
Safe extend to bypass constructors that throw Errors.
/**
* This piece of code has been created to safely extend classes/objects in Javascript.
* After talk with a great friend that was upset trying to extend a class/object that throws an error
* if some parameter in the constructor of the class/object is missing.
*
* var Search = function ( sToSearch ) {
* if ( sToSearch == null ) { // Check if sToSearch is null or undefined
* throw new Error( 'Search needs a string to search' );
* }
* this.sToSearch = sToSearch;

These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):

  1. Install Raspbian - http://www.raspberrypi.org/downloads

  2. Install the necessary dependecies:

sudo apt-get install git-core build-essential

(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)

@carlosvillu
carlosvillu / mongod init script
Created August 21, 2011 11:19 — forked from joonyou/mongod init script
mongodb start script
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}