Skip to content

Instantly share code, notes, and snippets.

View roman's full-sized avatar

Roman Gonzalez roman

View GitHub Profile
op2str :: Op -> String
op2str Plus = " + "
op2str Minus = " - "
op2str Mul = " * "
op2str Div = " / "
op2str Pow = " ^ "
prettyShow :: (Show a, Num a) => SymbolicManip a -> String
prettyShow = fst . prettyShow'
@roman
roman / env.rb
Created September 2, 2009 21:55 — forked from tpope/env.rb
# Enable Webrat's Selenium mode if one or more scenarios is tagged @selenium
Webrat.configure do |config|
config.mode = :rails
ObjectSpace.each_object(Cucumber::Ast::Features) do |features|
config.mode = :selenium if features.tag_count('selenium').nonzero?
end
end
" Vim color file
" Maintainer: Roman Gonzalez <romanandnreg at gmail dot com>
" Last Change: 2009 Aug 11
" Version: 0.0.1
" Screenshot: http://img.skitch.com/20090811-ti4b27qbftjybmau32ruygjjwx.jpg
" URL: http://blog.romanandreg.com
" For now this will only work on gvim
set background=dark
class RomanTestsController < ApplicationController
def index
render :action => 'index', :layout => false
end
def another
embed_action :controller => 'roman_embedded',
:action => 'index'
end
import java.util.*;
import java.security.*;
public class MyEnvironment {
public static void main (String[] args) {
Map<String, String> m = System.getenv();
for(String k : m.keySet()) {
System.out.printf("%s = %s\n", k, m.get(k));
}
@roman
roman / page_205_exercises.hs
Created April 16, 2009 08:23
Real World Haskell Exercises
module GlobRegex
(
globToRegex,
matchesGlob
)
where
import Text.Regex.Posix ((=~))
import Data.Char (toLower)
require "ruby_openid_test_server"
class TestHelper < Test::Unit
include RubyOpenIdTestServer::ServerSpecHelper
# The identity on the rots server (must be the same as the one executing)
self.rots_config = YAML.load(<<-CONFIG
identity: john.doe
sreg:
nickname: jdoe
this.suggestionFiller = this.fireEvent.delay(500, this, ['inputChanged', possibleSuggestions]);
migration 8, :add_projects_users do
up do
create_table :projects_users do
column :user_id, Integer, :key => true
column :project_id, Integer, :key => true
end
end
down do
mysql> describe projects_users;
+------------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------+------+-----+---------+-------+
| user_id | int(11) | YES | | NULL | |
| project_id | int(11) | YES | | NULL | |
+------------+---------+------+-----+---------+-------+