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 / .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 / .gitignore
Created September 6, 2012 11:20
Script to import from Wordpress XML to Markdown for Jekyll
*.xml
*.md
@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 / gist:402955
Created May 16, 2010 15:58
Useful bash Tidbits
mkcd()
{
mkdir -p "$*"
cd "$*"
}