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
require 'sinatra' | |
require 'dm-core' | |
require 'dm-migrations' | |
require 'haml' | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
class Message | |
include DataMapper::Resource |
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
require 'sinatra' | |
require 'haml' | |
# Session needs to be before Rack::OpenID | |
use Rack::Session::Cookie | |
require 'rack/openid' | |
require 'gapps_openid' | |
use Rack::OpenID |
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
#!/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") |
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
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) |
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
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' |
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 <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; |
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
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!" |
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 <string.h> | |
#include <boost/tr1/memory.hpp> | |
class Image { | |
public: | |
Image(std::string className = "Image") | |
: className_(className) | |
{} |
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
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" |
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
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'] |
OlderNewer