Skip to content

Instantly share code, notes, and snippets.

View roman's full-sized avatar

Roman Gonzalez roman

View GitHub Profile
class RomanTestsController < ApplicationController
def index
render :action => 'index', :layout => false
end
def another
embed_action :controller => 'roman_embedded',
:action => 'index'
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
@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
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 / gist:231304
Created November 10, 2009 21:47 — forked from hassox/gist:231290
module Foo
def test
self.class::Baz
end
end
=> nil
class Bar
include Foo
class Baz
import System.Random hiding (next)
randomsIO :: Random a => IO [a]
randomsIO =
getStdRandom $ \g ->
let (a, b) = split g
in (randoms a, b)
class WorkerForker
ReloadWorkerMessage = Class.new(StandardError)
class Worker
def initialize(ppid, stream)
@ppid = ppid
@pid = Process.pid
@stream = stream
- # app/views/posts/_post.html
%h1= post.title
...
%p Actions:
%ul
- # checking the authorizations on the view...
%li= edit_post_path(post) if current_user.can?(:update, post)
%li= post_path(post) if current_user.can?(:read, post)
module MethodInterceptor
def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
# we declare the method_list on the class env
@_instance_method_list = base.instance_methods.inject(Hash.new) do |methods, method_name|
# we undef all methods
if !%w(__send__ __id__ method_missing class).include?(method_name)
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import qualified Data.Map as M
import Data.List (isSuffixOf, isPrefixOf)
import Control.Arrow (second)
import Control.Monad (mapM_)
import Control.Monad.State
newtype ParamsParserMonad a = PPM (State (M.Map String [String]) a)
deriving (Monad)