Skip to content

Instantly share code, notes, and snippets.

View CalvinRodo's full-sized avatar

Calvin Rodo CalvinRodo

View GitHub Profile
@CalvinRodo
CalvinRodo / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
description "Upstart script to run a nodejs app as a service"
author "Louis Chatriot"
env NODE_BIN=/usr/local/bin/node
env APP_DIR=/path/to/app/dir
env SCRIPT_FILE="scriptfile.js" # Entry point for the nodejs app
env LOG_FILE=/path/to/logfile.log
env RUN_AS="anyuser" # Upstart can only be run nicely as root, need to drop privileges
env SERVER_ENV="anything" # Usual apps can be run in different environments (development, test, production ...)
# I typically use the environment variable NODE_ENV (see below)
# Ubuntu upstart file at /etc/init/mongodb.conf
pre-start script
mkdir -p /var/lib/mongodb/
mkdir -p /var/log/mongodb/
end script
start on runlevel [2345]
stop on runlevel [06]
@CalvinRodo
CalvinRodo / class.java
Created June 21, 2012 14:01 — forked from anonymous/class.java
is this done correctly?
Public void CalculatePrivateRoom(){
type = "Private";
cost = privateRoom;
medication *= 2;
cost *= noOfDays;
medication *= noOfDays;
telephone *= noOfDays;
television *= noOfDays;
total = television + telephone + medication + cost;
}
@CalvinRodo
CalvinRodo / gist:2917566
Created June 12, 2012 13:39
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@CalvinRodo
CalvinRodo / gist:2771479
Created May 22, 2012 20:38 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/2771479)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@CalvinRodo
CalvinRodo / lastfm.js
Created May 17, 2012 12:43 — forked from theVDude/lastfm.js
Last.fm plugin for ircnode bot using mongodb
// A last.fm nowplaying plugin.
// Author: thevdude ([email protected])
//
// Uses installed node modules mongoose, lastfm, inflection, and bitly.
//
// Current functions include:
// Display user's currently or last played track (np)
// Compare lastfm users with the tasteometer (cp)
// Get a users lastfm url (url)
// Find a user's top ten artists for different time periods (topten)
@CalvinRodo
CalvinRodo / Piglatin
Created April 4, 2012 19:59 — forked from anonymous/Piglatin
Take word, decide if first letter is capitalized, a vowel, and if the word has any vowels.
#include <iostream>
#include <ctime>
#include <ctype.h>
using namespace std;
const int wordSIZE = 50;
void checkVowel(char word[], int size, bool &first_VOWEL, bool &first_CAP, bool &VOWEL );
int arrayLength(char[]);