This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Yeti | |
def self.included(base) | |
base.send :extend, ClassMethods | |
end | |
module ClassMethods | |
def crud(klass,opts = {}) | |
class_variable_set(:@@model,klass) | |
self.class_eval CRUD_CODE | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
int ch; | |
while ((ch = getchar()) != EOF) | |
putchar(ch); | |
putchar('\n'); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pcreposix.h> | |
#include <stdio.h> | |
int main(void) | |
{ | |
regex_t rx; | |
char *pat = "([0-2]?\\d{1,2})\\.([0-2]?\\d{1,2})\\.([0-2]?\\d{1,2})\\.([0-2]?\\d{1,2})"; | |
// More "ambitious" expression - "(?:([0-2]?\\d{1,2})\\.){3}([0-2]?\\d{1,2})"; | |
char *str = "123.45.67.89"; | |
regmatch_t match [6]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (pmatch el) | |
(lambda (parser) | |
(p-cond parser | |
((lambda (parser) | |
(if (eqv? (p-car parser) el) | |
(p-advance parser) | |
(p-fail-parser parser))))))) | |
(define (pmany op) | |
(lambda (parser) | |
(letrec ((loop (lambda (cur-stream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <pcrecpp.h> | |
#include <string> | |
#include <map> | |
#include <fstream> | |
#define LINE_SIZE 256 | |
typedef std::map<std::string,std::string> Hash; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
#include <boost/foreach.hpp> | |
int main() | |
{ | |
std::string hello( "Hello, world!" ); | |
BOOST_FOREACH( char ch, hello ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: &defaults | |
# These are the settings for repository :default | |
# adapter: sqlite3 | |
# database: sample_development.db | |
adapter: couchdb | |
database: database | |
host: localhost | |
port: 4004 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match("/database").to(:controller => "proxy", :action => "index" ) | |
match("/database/:id").to(:controller => "proxy", :action => "index" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class People | |
include DataMapper::CouchResource | |
property :id, String, :serial => true, :key => true, :field => :_id | |
property :rev, String, :field => :_rev | |
property :title, String | |
end |