Skip to content

Instantly share code, notes, and snippets.

View carloslopes's full-sized avatar

Carlos Eduardo L. Lopes carloslopes

View GitHub Profile
require 'sinatra/base'
module Sinatra
module FragmentCache
def fragment_cache(name, age, &block)
if cache = read_fragment(name, age)
@_out_buf << cache
else
pos = @_out_buf.length
tmp = block.call
repo initialized in /Users/carloslopes/Projects/B2G
remote: Counting objects: 21614, done.
remote: Counting objects: 618498, done.
remote: Compressing objects: 100% (168650/168650), done.
remote: Compressing objects: 100% (7443/7443), done.
fatal: read error: Connection reset by peer82 MiB | 380 KiB/s
fatal: early EOF
fatal: index-pack failed
remote: Counting objects: 21614, done.
fatal: read error: Connection reset by peer3)
@carloslopes
carloslopes / gist:3959987
Created October 26, 2012 17:08
capybara-webkit stacktrace
...................................................................................................................................................................................................Finished "EnableLogging" with response "Success()"
Wrote response true ""
Received "Visit"
Started "Visit"
Load started
"Visit" started page load
Started request to "http://127.0.0.1:53196/sign_in"
Finished "Visit" with response "Success()"
Started request to "http://127.0.0.1:53196/assets/application.css"
Started request to "http://127.0.0.1:53196/assets/application.js"
@carloslopes
carloslopes / ajaxify-html5.js
Created August 28, 2012 14:36 — forked from balupton/README.md
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
// https://gist.github.com/854622
(function(window,undefined){
// Prepare our Variables
var
History = window.History,
$ = window.jQuery,
document = window.document;
// Check to see if History.js is enabled for our Browser
Failures:
1) RegistrationsController GET show content should have the personal informations
Failure/Error: expect(response.body).to have_selector('dd#email', :text => @user.email.html_safe)
expected css "dd#email" with text "<a href=\"mailto:email@example.com\">email@example.com</a>" to return something
@carloslopes
carloslopes / gist:3296532
Created August 8, 2012 16:43
Handle Thread across routes in sinatra
require 'sinatra'
set :threads, []
get '/' do
settings.threads << Thread.new { sleep 10 }
'New thread created'
end
get '/threads' do