Skip to content

Instantly share code, notes, and snippets.

Avatar
👻

Ryan Cook cookrn

👻
View GitHub Profile
@cookrn
cookrn / config.ru
Created Jun 10, 2011
Rack 1.3.0 & Serving Static Files
View config.ru
# Set Our Root Path
::ROOT = File.dirname( File.expand_path( __FILE__ ) )
# Boot The App
require "#{ROOT}/config/boot.rb"
# Serve our index file by default
use Rack::Static , :urls => { "/" => "index.html" } , :root => "public"
# Setup Rack
@cookrn
cookrn / core.clj
Created Jul 27, 2011
Your First Clojure Web App
View core.clj
(ns myfirstwebapp.core)
(defn app [req]
{:status 200
:headers {"content-Type" "text/html"}
:body "Hello World!"})
View hole1_fizzbuzz.rb
# HOLE 1
#
# Given a number the function returns “Fizz” if it is a multiple of 3,
# “Buzz” if it is a multiple of 5 and “FizzBuzz” if it is a multiple of
# 15. If the number is not a multiple of 3 or 5 then the number is
# returned as a string.
# Original answer
def fizzbuzz( n )
b,m="Buzz",n%5==0;n%3==0?"Fizz#{b if m}":m ?b:n
@cookrn
cookrn / Gemfile
Created Dec 12, 2011
Sample RBX Error Output
View Gemfile
source :rubygems
gem "sinatra"
group :development do
gem "foreman"
end
@cookrn
cookrn / app.js
Created Dec 26, 2011
Push to Resque Queue from Node
View app.js
require( './boot' );
var DbItem = require( './db_item' )
, item = new DbItem( '123456abcdefg' );
item.queue( function( error , response ){
console.log( 'Response: ' + response );
process.exit();
} );
@cookrn
cookrn / rake.zsh
Created Feb 19, 2012
Run rake with environment properly loaded
View rake.zsh
#!/usr/bin/env zsh
rvm-shell "ruby-1.9.3-p0" -c "foreman run bundle exec rake "$argv
@cookrn
cookrn / install.bash
Created Feb 28, 2012
Simple Bash Script To Bootstrap Ubuntu Server
View install.bash
#!/bin/bash
## README
# To run this script
# => scp it to the server
# => run `sudo bash install.bash`
# Preparations
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | tee -a /etc/apt/sources.list # MongoDB Prep
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 # MongoDB Prep
View question_1.js
// QUESTION
// write a javascript class, called 'Foo', with a class method 'bar' and an
// instance method 'bar'
var Foo = function Foo(){
console.log('new Foo instance');
};
Foo.bar = function(){
console.log('Foo::bar');
@cookrn
cookrn / privacy_policy.markdown
Created Mar 12, 2012 — forked from devver/privacy_policy.markdown
Antiqua, Ltd. Privacy Policy
View privacy_policy.markdown

Privacy Policy

Last revised on 03-12-2012

The Gist

Antiqua, Ltd. will collect certain non-personally identify information about you as you use our sites. We may use this data to better understand our users. We can also publish this data, but the data will be about a large group of users, not individuals.

The only personal information required to use the service is your email. This will never be sold, disclosed, or otherwise transferred without explicit advance notification (a minimum of 30 days) and the ability to opt out. The only likely scenario where this would be the case is an acquisition of Antiqua, Ltd..