Skip to content

Instantly share code, notes, and snippets.

View sebastiangeiger's full-sized avatar
🐕

Sebastian Geiger sebastiangeiger

🐕
View GitHub Profile
require 'sinatra'
require 'dm-core'
require 'dm-migrations'
require 'haml'
DataMapper.setup(:default, 'sqlite3::memory:')
class Message
include DataMapper::Resource
require 'sinatra'
require 'haml'
# Session needs to be before Rack::OpenID
use Rack::Session::Cookie
require 'rack/openid'
require 'gapps_openid'
use Rack::OpenID
#!/usr/bin/ruby
require 'rubygems'
require "mechanize"
require 'logger'
def crawl_dkb(credentials)
agent = Mechanize.new { |a| a.log = Logger.new("mech.log") }
agent.user_agent_alias = 'Mac Safari'
page = agent.get("https://banking.dkb.de/dkb/-?$javascript=disabled")
login_form = page.form_with(:name => "login")
GEM
remote: http://rubygems.org/
specs:
ZenTest (4.5.0)
abstract (1.0.0)
actionmailer (3.0.7)
actionpack (= 3.0.7)
mail (~> 2.2.15)
actionpack (3.0.7)
activemodel (= 3.0.7)
MestOMatic::Application.routes.draw do
resources :projects do
resources :deliverables
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
@sebastiangeiger
sebastiangeiger / Example.cpp
Created July 15, 2011 07:39
non-static reference member 'A& B::myA', can't use default assignment operator
#include <iostream>
#include <vector>
using namespace std;
class A; //Forward declaration
class B{
public:
B(string name, A& a):myA(a), name(name){
cout << "Works with pointer" << endl;
brad@brad-laptop:~ $ macirb
irb(main):001:0> framework 'Cocoa'
=> true
irb(main):002:0> app = NSApplication.sharedApplication
=> #<NSApplication:0x8003a8500>
irb(main):003:0> status_bar = NSStatusBar.systemStatusBar
=> #<NSSystemStatusBar:0x8003b8ec0>
irb(main):004:0> item = status_bar.statusItemWithLength(NSVariableStatusItemLength)
=> #<NSStatusItem:0x8003b7c00>
irb(main):005:0> item.title = "Hello MacRuby!"
@sebastiangeiger
sebastiangeiger / PolymorphismTest.cpp
Created October 26, 2011 11:14
Polymorphism in C++
#include <iostream>
#include <string.h>
#include <boost/tr1/memory.hpp>
class Image {
public:
Image(std::string className = "Image")
: className_(className)
{}
@sebastiangeiger
sebastiangeiger / ambiguities.py
Created December 22, 2011 15:23
NLTK homework
import locale
import nltk
from nltk.corpus import wordnet as wn
from nltk.tag.simplify import simplify_wsj_tag
def main():
string = "I saw a man who is 98 years old and can still walk and tell jokes."
tokens = nltk.word_tokenize(string)
print nice_formatting(combinations_without_wordtype(tokens)) + " possible combinations when not taking wordtype into account"
print nice_formatting(combinations_with_wordtype(tokens)) + " possible combinations when taking wordtype into account"
Gem::Specification.new do |s|
s.name = 'genetic_algorithm'
s.version = '0.0.1'
s.platform = Gem::Platform::RUBY
s.author = 'Sebastian Geiger'
s.email = '[email protected]'
s.summary = 'A primitive and unfinished genetic algorithm'
s.description = 'This algorithm will take a vector of a fixed length togther with a sum constraint and an executable. The executable must return the performance indicator, the vector should be consumed by the block in order to configure its operation. The performance measure is used to optimize the vector. This is work in progress!'
s.files = ['genetic_algorithm.rb']