Super simple library for using subdomains in your rails routes.
Lets you do
subdomain('online') do
root :to => 'online#index'
end
in your routes.rb.
Angular compatible link_to. Turns
<%= link_to "Sign up", "/users/sign_up" %>
into
Like content_for but takes a default output from a block if content_for? hasn't been set.
= content_default(:sidebar) do
= render 'sidebar'
class VntReader | |
def initialize(file) | |
@file=file | |
end | |
def body | |
@file.each_line.select{|l|l.match /\ABODY/}.first.chomp | |
end | |
def content |
module SignInHelpers | |
def sign_up_as(user_type, form_params={}) | |
attributes = FactoryGirl.attributes_for(user_type).merge(form_params) | |
destory_user(attributes[:email]) | |
visit '/users/sign_up' | |
within("#new_user") do | |
fill_in "Name", :with => attributes[:name] | |
fill_in "Email", :with => attributes[:email] | |
fill_in "Password", :with => attributes[:password] |
# http://www.codewars.com/kata/batchitemprocessor/ruby | |
require './batchitemprocessor' | |
class Test | |
# This class mimics the one provided in the kata | |
def self.assert_equals(actual, expected, message="") | |
if actual!=expected | |
puts "\nTest '#{message}' failed.\nExpected #{expected}\nGot #{actual}" | |
else | |
puts "." |
-- Copyright (c) 2006 Spencer Janssen | |
-- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) | |
{-# LANGUAGE Rank2Types #-} | |
module Main where | |
import Control.Monad | |
import Data.Generics |
namespace :sprites do | |
originals = Rake::FileList.new('app/assets/images/**/originals/*.png') | |
resized = originals.pathmap("%{/originals$,/}d%f") | |
task resize: resized | |
end | |
from_originals = ->(tn) { | |
tn.pathmap("%d/originals/%f") | |
} |
module AuthHelper | |
module Feature | |
def basic_auth(login, password) | |
if page.driver.respond_to?(:basic_auth) | |
page.driver.basic_auth(login, password) | |
elsif page.driver.respond_to?(:basic_authorize) | |
page.driver.basic_authorize(login, password) | |
elsif page.driver.respond_to?(:browser) && page.driver.browser.respond_to?(:basic_authorize) | |
page.driver.browser.basic_authorize(login, password) | |
else |