Like content_for but takes a default output from a block if content_for? hasn't been set.
= content_default(:sidebar) do
= render 'sidebar'
RSpec::Matchers.define :exceed_query_limit do |expected| | |
supports_block_expectations | |
match do |block| | |
query_count(&block) > expected | |
end | |
failure_message_when_negated do |actual| | |
"Expected a maximum of #{expected} queries, got #{@recorder.count}:\n\n#{@recorder.log_message}" | |
end |
source 'https://rubygems.org' | |
ruby '2.0.0' | |
gem 'sinatra' | |
gem 'rspec' | |
gem 'rack-test' |
#!/usr/bin/ruby | |
require 'nokogiri' | |
require 'open-uri' | |
#require 'debugger' | |
require 'cgi' | |
url = "http://www.google.co.uk/search?q=#{ARGV.join('+')}" | |
puts url | |
doc = Nokogiri::HTML(open(url)) | |
# debugger |
class PoltergeistNetworkMonitor | |
require 'pstore' | |
require 'uri' | |
require 'fileutils' | |
def initialize(page) | |
@page = page | |
end | |
def print_requests(longer_than_seconds:) |
module CapybaraHooks | |
def after_page_change | |
end | |
Capybara::Session::DSL_METHODS.each do |method| | |
define_method method do |*args, &block| | |
old_page = page.current_url | |
super(*args, &block) | |
new_page = page.current_url |
// | |
//To Track Thy Youtube Upon Google Analytics | |
//Regardless the number of Players upon thy stage | |
//Revised and Revisioned to Version 2.1 | |
//Within the March of Two Thousand and Thirteen | |
// | |
//Performed by LunaMetrics http://www.lunametrics.com @lunametrics | |
//and Sayf Sharif @sayfsharif | |
// | |
//Who beg thy forgiveness for the lack of the regular expression |
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