Skip to content

Instantly share code, notes, and snippets.

@denmerc
denmerc / chat.js
Created March 9, 2012 20:57 — forked from pgte/chat.js
Node Tuts episode 7
var http = require('http'),
sys = require('sys'),
fs = require('fs'),
io = require('socket.io');
var server = http.createServer(function(request, response) {
response.writeHead(200, {
'Content-Type': 'text/html'
});
@denmerc
denmerc / app.js
Created March 9, 2012 21:09 — forked from alessioalex/app.js
From Pedro Teixeira's http://nodetuts.com/tutorials/12-file-uploads-using-nodejs-and-express.html but with connect-form instead of multipart-js
var express = require('express'),
form = require('connect-form'),
fs = require('fs'),
util = require('util');
var app = express.createServer(
form({keepExtensions: true})
);
// switch between development and production like this:
@denmerc
denmerc / app.js
Created March 9, 2012 21:11 — forked from alessioalex/app.js
From Pedro Teixeira's http://nodetuts.com/tutorials/12-file-uploads-using-nodejs-and-express.html but with connect-form instead of multipart-js
var express = require('express'),
form = require('connect-form'),
fs = require('fs'),
util = require('util');
var app = express.createServer(
form({keepExtensions: true})
);
// switch between development and production like this:
@denmerc
denmerc / app.js
Created March 9, 2012 21:18 — forked from pgte/app.js
Node Tuts episode 9 - Express
var express = require('express');
var app = express.createServer();
app.configure('development', function () {
app.use(express.logger());
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));
@denmerc
denmerc / nodejs_express_mongodb.js
Created March 10, 2012 00:25 — forked from anonymous/nodejs_express_mongodb.js
trying to DRY up my code
// database.js
sys = require('sys');
var mongo = require('./lib/node-mongodb-native/lib/mongodb'),
Connection = mongo.Connection,
Server = mongo.Server,
BSON = mongo.BSONNative;
var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? process.env['MONGO_NODE_DRIVER_HOST'] : 'localhost';
var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? process.env['MONGO_NODE_DRIVER_PORT'] : Connection.DEFAULT_PORT;
@denmerc
denmerc / app.js
Created March 10, 2012 04:02 — forked from pgte/app.js
Node Tuts episode 9 - Express
var express = require('express');
var app = express.createServer();
app.configure('development', function () {
app.use(express.logger());
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));
@denmerc
denmerc / README
Created September 9, 2012 18:58 — forked from LukasKnuth/README
A simple script that helps setting up your portable tools in the msysgit-shell.
-- Add Portable software to your msysgit-PATH --
If you like to work with your *nix shell even under Windows, you'll
likely use the git-bash provided by msysgit a lot.
A problem might be, that you don't have your tools in the PATH of that
shell and therefore can't use them. Those tools might be on the same
USB-drive as the git-shell, so you would have to adjust the PATH
(if you're allowed to) every time the drive-letter changes.
@denmerc
denmerc / controllers.js
Created November 20, 2012 18:55 — forked from corkupine/controllers.js
Controller that makes use of angular-auth
var mod = {};
mod.AuthCtrl = [
'$scope', 'requests401', '$http', 'Ping', '$location', function($scope, requests401, $http, Ping, $location) {
var fadespeed = 300;
$scope.user = {
"username": "test",
"password": "test"
};
#!/usr/bin/env sh
VBOX_LATEST_VERSION=$(curl http://download.virtualbox.org/virtualbox/LATEST.TXT)
wget -c http://download.virtualbox.org/virtualbox/${VBOX_LATEST_VERSION}/VBoxGuestAdditions_${VBOX_LATEST_VERSION}.iso -O /tmp/VBoxGuestAdditions_${VBOX_LATEST_VERSION}.iso
sudo mkdir -p /media/guestadditions ; sudo mount -o loop /tmp/VBoxGuestAdditions_${VBOX_LATEST_VERSION}.iso /media/guestadditions
sudo /media/guestadditions/VBoxLinuxAdditions.run
sudo umount /media/guestadditions && sudo rm -rf /tmp/VBoxGuestAdditions_$VBOX_VERSION.iso /media/guestadditions
echo 'You may safely ignore the message that reads: "Could not find the X.Org or XFree86 Window System."'
# Cookbook Name:: mongodb
# Recipe:: default
case node['platform']
when "ubuntu"
execute "apt-get update" do
action :nothing
end
execute "add gpg key" do