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 RomanTestsController < ApplicationController | |
def index | |
render :action => 'index', :layout => false | |
end | |
def another | |
embed_action :controller => 'roman_embedded', | |
:action => 'index' | |
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
" 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 |
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
# 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 |
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
op2str :: Op -> String | |
op2str Plus = " + " | |
op2str Minus = " - " | |
op2str Mul = " * " | |
op2str Div = " / " | |
op2str Pow = " ^ " | |
prettyShow :: (Show a, Num a) => SymbolicManip a -> String | |
prettyShow = fst . prettyShow' |
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 Foo | |
def test | |
self.class::Baz | |
end | |
end | |
=> nil | |
class Bar | |
include Foo | |
class Baz |
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 System.Random hiding (next) | |
randomsIO :: Random a => IO [a] | |
randomsIO = | |
getStdRandom $ \g -> | |
let (a, b) = split g | |
in (randoms a, b) |
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 WorkerForker | |
ReloadWorkerMessage = Class.new(StandardError) | |
class Worker | |
def initialize(ppid, stream) | |
@ppid = ppid | |
@pid = Process.pid | |
@stream = 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
- # 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) |
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 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) |
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
{-# 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) |