Skip to content

Instantly share code, notes, and snippets.

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@okor
okor / gist:788206
Created January 20, 2011 17:13
Install node.js on Ubuntu 10.10
# As of 10/07/2011, this bash script installs Node.js
# and npm (a node package manager) on Ubuntu 10.10 or 10.04 x64.
# This installs node in your home directory (~/.local/programs)
#
# by okor
#
# Copy, Paste and Run in a terminal:
echo "Install required packages" && \
sudo apt-get update && \
@marcuswestin
marcuswestin / Selenium-SauceLabs-NodeJS.js
Created March 21, 2011 21:29
Get started using Selenium with SauceLabs and NodeJS
require('soda').createSauceClient({ 'username': 'username-string', 'access-key': 'access-key-string',
'url': 'http://example.saucelabs.com/', 'max-duration': 300,
'os': 'Windows 2003', 'browser': 'firefox', 'browser-version': '3.6',
'name': 'This is an example test' }).chain.session()
.open('/')
.getTitle(function(title){
require('assert').ok(~title.indexOf('Cross browser testing with Selenium - Sauce Labs'), 'Title did not include the query');
})
.testComplete()
.end(function(err){
@joelg
joelg / gist:932496
Created April 20, 2011 19:40
Code for the Buffer Button in Wordpress
<a href="http://bufferapp.com/add" class="buffer-add-button" data-text="<?php the_title(); ?>" data-url="<?php the_permalink(); ?>" data-via="(Your Twitter username, without @)" data-count="horizontal">Buffer</a><script type="text/javascript" src="http://static.bufferapp.com/js/button.js"></script>
@j4mie
j4mie / gunicorn-projectname.conf
Created May 13, 2011 08:07
upstart configuration for gunicorn
description "upstart configuration for gunicorn"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /home/jamie/.virtualenvs/projectname/bin/gunicorn_django -c /home/jamie/code/projectname/gunicorn.py /home/jamie/code/projectname/settings/production.py
@pksunkara
pksunkara / config
Last active April 28, 2024 18:59
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
@dshaw
dshaw / application.js
Created June 8, 2011 17:43 — forked from fabware/application.js
socket.io application and haproxy configuration
var express = require('express');
var redis = require('redis');
const serverType = process.argv[2];
const serverHost = process.argv[3];
const serverPort = parseInt(process.argv[4]);
const redisPort = 6379;
const redisHost = '127.0.0.1';
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@rbscott
rbscott / elasticsearch.conf
Created June 28, 2011 19:46
upstart job for elastic search
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@taf2
taf2 / reconnect-on-disconnect.js
Created July 1, 2011 15:51
mongoose node.js reconnect code
var mongoose = require('mongoose');
var db = mongoose.connect("mongodb://localhost/testdb");
var reconnTimer = null;
function tryReconnect() {
reconnTimer = null;
console.log("try to connect: %d", mongoose.connection.readyState);
db = mongoose.connect("mongodb://localhost/testdb");
}