Skip to content

Instantly share code, notes, and snippets.

@bdtomlin
bdtomlin / gitingore
Created May 10, 2010 00:14
.gitignore
.bundle
db/*.sqlite3
log/*.log
tmp/
.sass-cache/
config/database.yml
*.DS_Store
*.swp
*.swo
@bdtomlin
bdtomlin / nginx.conf
Created May 28, 2010 04:43
development nginx.conf
#user nobody;
worker_processes 2;
#pid logs/nginx.pid;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
events {
worker_connections 1024;
@bdtomlin
bdtomlin / nginx ruby script
Created July 5, 2010 18:33
nginx ruby script
#!/usr/bin/env ruby
USAGE = %{
Usage:
Put this script somewhere in your path, I use ~/bin
chmod +x to make it executable.
nginx start (starts nginx)
nginx stop (stops nginx)
nginx restart (calls stop and then start)
@bdtomlin
bdtomlin / mongod ruby script
Created July 5, 2010 20:57
mongod ruby script
#!/usr/bin/env ruby
USAGE = %{
Usage:
Put this script somewhere in your path, I use ~/bin
chmod +x to make it executable
mongod start (starts mongod)
mongod stop (stops mongod)
mongod stat (calls ps aux|grep ... to see if mongod is running)
var countdown = (function(){
var index;
function log(){
console.log(index);
}
function iterate(){
log();
@bdtomlin
bdtomlin / gist:3018817
Created June 29, 2012 16:02
HomeWork 1
var CARS = [
{ color: 'blue', make: 'BMW' },
{ color: 'red', make: 'Ferrari' }
];
var logCar = function(car){
console.log("I'm a " + car['color'] + ' ' + car['make'])
}
function Car(make, color){
@bdtomlin
bdtomlin / gist:3018831
Created June 29, 2012 16:04
HomeWork 2
Function.prototype.cached = function(){
var that = this;
var cache = {};
return function(arg){
if(arg in cache){
return cache[arg];
}else{
cache[arg] = that(arg);
return cache[arg];
}
// 1. Write a class to support the following code:
var Person = function(name){
this.name = name;
};
Person.prototype.getName = function(){
return this.name;
};
var thomas = new Person('Thomas');
@bdtomlin
bdtomlin / nginx
Created July 3, 2012 15:34
Nginx init script
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
.mad-libs-content {
position: relative;
}
.animate-questions, .animate-results {
position: absolute;
top: 0;
left: 0;
right: 0;
}