Skip to content

Instantly share code, notes, and snippets.

View alfakini's full-sized avatar

Alan R. Fachini alfakini

View GitHub Profile
#!/bin/bash
curl -s "https://octodex.github.com/" | grep "<img.*data-src" | grep -o "/images.*\.png" | while read line; do
line="https://octodex.github.com$line"
wget $line
done
# -*- encoding : utf-8 -*-
class AccountLogoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
if Rails.env.development? || Rails.env.test?
storage :file
else
storage :s3
s3_access_policy 'public-read'
end
@alfakini
alfakini / pr.md
Created January 3, 2014 04:15 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@alfakini
alfakini / gist:6106012
Last active December 20, 2015 09:09 — forked from anonymous/gist:6105990
Como fazer mocking de dependências internas? Refletindo sobre o tópico levantado aqui: http://www.polignu.org/artigo/um-padr%C3%A3o-para-mock-de-depend%C3%AAncias-internas-em-testes-de-unidade
public class RotaFinderFactory {
private static RotaFinderFactory rotaFinderFactory = null;
private RotaFinderFactory() { }
// Singleton
public static RotaFinderFactory getFactory() {
if(rotaFinderFactory == null) {
rotaFinderFactory = new RotaFinderFactory();
}
return rotaFinderFactory;
@alfakini
alfakini / gist:a32b9bf3cc1e5c534e40
Created January 31, 2013 05:04
Using Scrapy to find wrong escaped html code on a Rails 2.3 app with rails_xss plugin installed.
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http.request import Request
class HomeSpider(BaseSpider):
name = "rails_xss"
root = "http://0.0.0.0:3000/"
start_urls = [root]
def parse(self, response):
@alfakini
alfakini / git-global-config
Created December 2, 2011 15:20
Git global config
[user]
name = xxxx
email = xxxx
[github]
user = xxxx
token = xxxx
[web]
browser = google-chrome
[core]
excludesfile = /Users/alfakini/.gitignore