Skip to content

Instantly share code, notes, and snippets.

View carloslopes's full-sized avatar

Carlos Lopes carloslopes

View GitHub Profile
@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
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 protected]\">[email protected]</a>" to return something
@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
@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"
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)
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
@carloslopes
carloslopes / gist:6306255
Last active September 3, 2017 09:44 — forked from joost/ruby_google_analytics_server_to_server.md
Google Analytics API (server-to-server) using Ruby
Msg 208, Level 16, State 1, Procedure FN_CLUBE_VANTAGENS_CAMPANHA, Line 15
Invalid object name 'TB_CAMPANHA'.
Msg 213, Level 16, State 1, Procedure JP_INS_PONTUACAO_CONSOLIDADA_PONTUACAO, Line 11
Column name or number of supplied values does not match table definition.
Msg 7308, Level 16, State 1, Procedure JP_INSERE_PARTICIPANTE_EXCEL, Line 11
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.
The module 'JP_APURACAO_INS_PREMIACAO_POL_2' depends on the missing object 'JP_APURACAO_INS_APROVACAO_NEGADO'. The module will still be created; however, it cannot run successfully until the object exists.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'CONSTR'.
@carloslopes
carloslopes / gist:6698708
Created September 25, 2013 12:05
Threaded sinatra app
sinatra_thread = Thread.new do
require 'sinatra/base'
class SinatraServer < Sinatra::Base
get '/hi' do
"Hello World!"
end
run!
end
~/Projects/PremiosOnline(branch:master) » rspec spec carloslopes@Carlos-MacBook-Air
.............................................................................................................................................2013-11-07 09:50:14.413 phantomjs[29903:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2013-11-07 09:50:14.413 phantomjs[29903:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
2013-11-07 09:50:14.416 phantomjs[29903:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
2013-11-07 09:50:14.417 phantomjs[29903:507] CoreText performance note: Client called CTFontCreateWithName() using n