Skip to content

Instantly share code, notes, and snippets.

@marcopompei
marcopompei / RequestPresenter.swift
Last active January 13, 2016 23:08
Using Protocol Extensions for reusable behavior
protocol RequestPresenter: class {
var loadingView: UIView? { get set }
func retryRequest(sender: UIButton)
}
extension RequestPresenter where Self: UIViewController {
func startedLoading() {
let activityIndicator = UIActivityIndicatorView()
addLoadingView(activityIndicator)
@marcopompei
marcopompei / gist:5312559
Created April 4, 2013 17:56
Can't install eventmachine, error building gem native extension
Marco-Antonio:~ marcopompei$ gem install eventmachine
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
/Users/marcopompei/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
@marcopompei
marcopompei / application.html.erb
Created September 13, 2010 16:34
A Tweet button Rails helper and some other simple helpers
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
@marcopompei
marcopompei / esperando_resultado_unesp.py
Created July 22, 2009 05:13
Fiz enquanto esperava o resultado do vestibular do meu irmão
import urllib
import time
url = "http://www.unesp.br/vestibular/"
a = urllib.urlopen(url).read()
b = urllib.urlopen(url).read()
i = 0
while (a == b):
i += 1
print i
b = urllib.urlopen(url).read()