Skip to content

Instantly share code, notes, and snippets.

View johnbellone's full-sized avatar
🏠
Working from home

John Bellone johnbellone

🏠
Working from home
View GitHub Profile
@johnbellone
johnbellone / Cheffile.rb
Created April 27, 2013 20:54
A simple Cheffile.
# -*- mode: ruby -*-
site "http://community.opscode.com/api/v1"
cookbook 'ruby_build', :git => "git://github.com/fnichol/chef-ruby_build"
cookbook 'rbenv', :git => "git://github.com/fnichol/chef-rbenv"
@johnbellone
johnbellone / rack_application.js
Created April 27, 2013 20:51
The rack application role.
{
// Some settings that are necessary for the Chef Solo to work
// as expected. If you use the Ruby DSL rather than JSON you
// can omit a few of these.
"name": "rack_application",
"description": "A simple role for a Rack application.",
"chef_type": "role",
"json_class": "Chef::Role",
// All of the recipes that we want to load into the VM.
@johnbellone
johnbellone / Vagrantfile
Last active December 16, 2015 17:59
Vagrantfile
# -*- mode: ruby -*-
Vagrant.configure("2") do |config|
# Match the base box name with the definition that your exported.
config.vm.box = "ubuntu-12.04-i386"
# We'll want to access our site on localhost.
config.vm.network :forwarded_port, guest: 8080, host: 8080
# Specific changes for the VB provider. Additional ones can be
@johnbellone
johnbellone / .gitignore
Last active December 14, 2015 06:39
Defining C objects in Ruby
a.out
*.o
*dSYM
@johnbellone
johnbellone / main.c
Last active December 14, 2015 03:19
Marrying Ruby and C
// $ gcc -I$HOME/.rvm/rubies/ruby-1.9.3-p374/include/ruby-1.9.1 \
// > -L$HOME/.rvm/rubies/ruby-1.9.3-p374/lib -lruby-static \
// > -DHAVE_STRUCT_TIMESPEC -std=c99 main.c
#include <ruby.h>
#include <stdio.h>
// Any errors are going to be stored in the global variable $!. So
// if we want to print this out we need to $!.to_s.
@johnbellone
johnbellone / flatten.cc
Created August 9, 2011 02:51
Flatten an std::map into an std::vector
// g++ -O3 -I/opt/local/include -L/opt/local/lib -lboost_system flatten.cc
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <boost/bind.hpp>
#include <boost/bind/placeholders.hpp>
@johnbellone
johnbellone / carousel.js
Created October 17, 2010 05:24
These are some changes I made to make the prototype-carousel implementation more robust.
@johnbellone
johnbellone / bounce.rake
Created October 13, 2010 03:19
A simple rake script to bounce a database.
namespace :db do
desc "Reset and migrate the current database"
task :bounce => :environment do
Rake::Task['db:reset'].invoke
Rake::Task['db:migrate'].invoke
end
end
@johnbellone
johnbellone / Berksfile
Last active September 14, 2015 19:40
Poise Ruby and Javascript
source 'https://supermarket.chef.io'
extension 'halite'
cookbook 'poise', gem: 'poise'
cookbook 'poise-javascript', gem: 'poise-javascript'
cookbook 'poise-ruby', gem: 'poise-ruby'
cookbook 'poise-ruby-build', gem: 'poise-ruby-build'
cookbook 'poise-languages', gem: 'poise-languages'
metadata
@johnbellone
johnbellone / gist:402955
Created May 16, 2010 15:58
Useful bash Tidbits
mkcd()
{
mkdir -p "$*"
cd "$*"
}