Like content_for but takes a default output from a block if content_for? hasn't been set.
= content_default(:sidebar) do
= render 'sidebar'
| 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") | |
| } |
| -- 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 |
| # 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 "." |
| 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] |
| class VntReader | |
| def initialize(file) | |
| @file=file | |
| end | |
| def body | |
| @file.each_line.select{|l|l.match /\ABODY/}.first.chomp | |
| end | |
| def content |
Like content_for but takes a default output from a block if content_for? hasn't been set.
= content_default(:sidebar) do
= render 'sidebar'
Angular compatible link_to. Turns
<%= link_to "Sign up", "/users/sign_up" %>
into
| App.accordion('.accordion','.item'); | |
| App.accordion = function(container,item){ | |
| var item_selector = container+' '+item; | |
| $(item_selector+' .header').css('cursor','pointer'); | |
| $(item_selector+' .header').on('click',function(){ | |
| $(this).closest(item).find('.body').slideToggle(); | |
| }); | |
| }; |