Skip to content

Instantly share code, notes, and snippets.

match("/database").to(:controller => "proxy", :action => "index" )
match("/database/:id").to(:controller => "proxy", :action => "index" )
class People
include DataMapper::CouchResource
property :id, String, :serial => true, :key => true, :field => :_id
property :rev, String, :field => :_rev
property :title, String
end
#include <string>
#include <iostream>
#include <boost/foreach.hpp>
int main()
{
std::string hello( "Hello, world!" );
BOOST_FOREACH( char ch, hello )
{
struct HelloWorld
{
void operator()() const
{
std::cout << "Hello, World!" << std::endl;
}
};
// ...
#include <boost/thread/thread.hpp>
#include <iostream>
int count = 0;
boost::mutex mutex;
void increment_count()
{
boost::mutex::scoped_lock lock(mutex);
std::cout << "count = " << ++count << std::endl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace Simplex
{
class Simplex
@JakubOboza
JakubOboza / gist:758456
Created December 29, 2010 11:51
Extlib Hooks example
require 'rubygems'
require 'extlib'
puts "Extlib Hooks Example"
class ManBearPig
include Extlib::Hook
def bear?
puts "Nope it isn't!"
time( ls -d **/* | xargs grep TODO | awk '{print $0 "\n" }' )
(; ls -d **/* | xargs grep TODO | awk '{print $0 "\n" }'; ) 0,01s user 0,01s system 102% cpu 0,019 total
time( ls -d **/* | xargs grep TODO | awk '{print $0 "\n" }' )
(; ls -d **/* | xargs grep TODO | awk '{print $0 "\n" }'; ) 0,01s user 0,01s system 102% cpu 0,019 total
time( find -P * | xargs grep TODO | awk '{print $0 "\n" }' )
(; find -P * | xargs grep TODO | awk '{print $0 "\n" }'; ) 0,00s user 0,01s system 88% cpu 0,017 total
time ( zargs **/* -- grep TODO | awk '{print $0 "\n" }' )
(; zargs **/* -- grep TODO | awk '{print $0 "\n" }'; ) 0,00s user 0,00s system 20% cpu 0,017 total
require 'rubygems'
require 'aasm'
# show me the caller name
module Wombatize
def method_name
caller[0][/`([^']*)'/, 1]
end
end