Skip to content

Instantly share code, notes, and snippets.

View runemadsen's full-sized avatar

Rune Skjoldborg Madsen runemadsen

View GitHub Profile
int i;
printf ("Checking if processor is available...");
if (system(NULL))
puts ("Ok");
else
puts ("Not Ok");
printf ("Executing command Open...\n");
ofxImage screenGrab;
screenGrab.setFromPixels((unsigned char *)_tex.getPixels(), _tex.getWidth(), _tex.getHeight(), OF_IMAGE_COLOR);
screenGrab.mirror(false, true);
screenGrab.saveImage("myimage.png");
@runemadsen
runemadsen / How to import dump folder into mongodb.sh
Created March 7, 2011 19:35
This shows how to import the data from a dump folder produced by mongodump
# Make sure MongoDB is installed and working
# Start the mongodb server in terminal
sudo mongod
# In another terminal window, run mongorestore command (second option pointing to dump folder on your HD)
mongorestore -d version_05 Documents/dump
require 'index.rb'
User.create(:name => "Rune")
d = Discussion.create(:date => Date.today)
d.image = Image.create(:url => 'http://inapcache.boston.com/universal/site_graphics/blogs/bigpicture/libya_032111/bp4.jpg', :user_id => 1)
d.image.images.create(:url => 'http://t0.gstatic.com/images?q=tbn:ANd9GcSUYGIZP5MiGjHqWNahu5aYBNwhC0iy276E-5swmXPu3WhXKb4b-g', :user_id => 1)
@runemadsen
runemadsen / Rails Generators
Created April 18, 2011 21:47
Rails generator snippets
rails generate migration AddInfoToUser
add_column :tablenames, :fieldname, :string
remove_column :tablenames, :fieldname
@runemadsen
runemadsen / Thesis Essay
Created April 26, 2011 00:10
Thesis essay
1. Introduction
Since the birth of the software development discipline, programmers have dedicated time and effort into creating digital tools that optimize the process of going from an initial idea to a fully fledged product. This task is a hard one. How do you model a tool to support the non-linear, unstructured process of thinking? How do you create a tool that allows you to turn your thoughts into a digital document? A tool where you can build upon this document, iterate away on tangents when you get inspired, and quickly revert to a former state if this proved unsuccessful? More important, how do you create a tool that allows a group of people to collaborate on the same project, when that project doesn't have a structured form yet?
One answer to this question is the concept of a version control system, that today plays a central role in any serious software development project. It allows individuals to iterate code-based projects in a flexible environment, and to share these improvements with collabora
@runemadsen
runemadsen / Branch queries for versionize
Created April 29, 2011 21:50
Branch queries for Versionize
a = Branch.create(:name => "Original", :alias => "master")
b = a.children.create(:name => "New Branch", :alias => "newbranch")
@runemadsen
runemadsen / grit inconsistensy?
Created April 30, 2011 03:47
Grit inconsistensy?
ree-1.8.7-2011.03 :003 > include Grit
=> Object
ree-1.8.7-2011.03 :004 >
ree-1.8.7-2011.03 :005 > # create repo
ree-1.8.7-2011.03 :006 > r = Repo.init_bare 'myrepo.git'
=> #<Grit::Repo "/Users/Rune/Projects/versionize/irbtest/myrepo.git">
ree-1.8.7-2011.03 :007 > i = r.index
=> #<Grit::Index:0x101eb7880 @repo=#<Grit::Repo "/Users/Rune/Projects/versionize/irbtest/myrepo.git">, @tree={}, @current_tree=nil>
ree-1.8.7-2011.03 :008 >
ree-1.8.7-2011.03 :009 > # first commit to master
var davids_data = {
timeline : {
name : "My Timeline",
annotations : [
{ start: 1, end : 34, type : "highlight", text : "Lorem Ipsum" },
// a2,
// a3,
// a4
]
}
Exiting
/Users/rune/.rvm/gems/ree-1.8.7-2011.03@live_dashboard/gems/gibbler-0.8.9/lib/gibbler.rb:453:in `__gibbler': undefined method `__gibbler' for #<ActionView::FileSystemResolver:0x103dd0ac8> (NoMethodError)
from /Users/rune/.rvm/gems/ree-1.8.7-2011.03@live_dashboard/gems/gibbler-0.8.9/lib/gibbler.rb:452:in `each'
from /Users/rune/.rvm/gems/ree-1.8.7-2011.03@live_dashboard/gems/gibbler-0.8.9/lib/gibbler.rb:452:in `__gibbler'
from /Users/rune/.rvm/gems/ree-1.8.7-2011.03@live_dashboard/gems/gibbler-0.8.9/lib/gibbler.rb:163:in `gibbler'
from /Users/rune/.rvm/gems/ree-1.8.7-2011.03@live_dashboard/gems/gibbler-0.8.9/lib/gibbler.rb:209:in `freeze'
from /Users/rune/.rvm/gems/ree-1.8.7-2011.03@global/gems/actionpack-3.0.9/lib/abstract_controller/view_paths.rb:66:in `view_paths='
from /Users/rune/.rvm/gems/ree-1.8.7-2011.03@global/gems/actionpack-3.0.9/lib/abstract_controller/view_paths.rb:51:in `prepend_view_path'
from /Users/rune/.rvm/gems/ree-1.8.7-2011.03@global/gems/railties-3.0.9/lib/rails/engine.rb:1