Skip to content

Instantly share code, notes, and snippets.

View rafapolo's full-sized avatar

Rafael Polo rafapolo

View GitHub Profile
@rafapolo
rafapolo / convert_large_1mb.sh
Created February 17, 2014 21:04
converte para 900px de largura toda imagem com mais de 1Mb
find . -size +1M | while read file_name; do sips $file_name --resampleWidth 900 ; done
@rafapolo
rafapolo / category_itens_per_col.rb
Last active August 29, 2015 14:07
define número de elementos por colunas
# backend
def category_itens_per_col(total)
return case total
when 0..3 then 1
when 4..6 then 2
when 7..9 then 3
else 4
end
end
@rafapolo
rafapolo / dataviz.rb
Created November 27, 2014 16:53
Convert Jeff's .XLS into a .DOT Graph file
#!/usr/bin/env ruby
#encoding: utf-8
#comment: Convert Jeff's .XLS into a .DOT Graph file
# configurations
file = "kenya.xls"
# columns to export as graph nodes
columns = ["Project", "Platform", "Developer", "Organization", "Funder", "Category", "Type"]
# how columns connect to each other
relations = {
@rafapolo
rafapolo / zeitbank.db.js
Last active August 29, 2015 14:11
zeitbank database #1
// this is the zeitbank database #1
// filled during the gütermarkt #3
// to do:
// - server-side script to serve this file - the people database
// - show last_updated_ago
// - cliente-side script to read it and render as a CNN news style
// - convert type face to web version // ask jolanda
people = [
@rafapolo
rafapolo / app.js
Created March 11, 2015 20:00
certcheck.me animations
$(document).ready(function() {
$(".item[cert='{{cert}}']").css('border', '5px solid #FFBD09');
$('.item').hover(
function(){
icon = $(this).children().children();
icon.attr('off', icon.attr('src'));
icon.attr('src', '/static/img/scary.svg');
},
function(){
icon.attr('src', icon.attr('off'));
@rafapolo
rafapolo / get_content_from_page.rb
Created June 2, 2015 12:23
Get body content from django_CMS Page model
def db # connects to old database
Mysql2::Client.new(host: 'localhost', username: 'root', database: 'eti')
end
def select(from)
puts '='*20
exec = "SELECT * from #{from}"
puts exec
puts '='*20
db.query(exec)
@rafapolo
rafapolo / PegaCodafm.rb
Created February 24, 2010 01:58
PegaCoda
#!ruby19
# encoding: utf8
# author: rafael polo
# created_at 23.fev.2010
require 'open-uri'
require 'timeout'
require 'cgi'
class PegaCoda
@rafapolo
rafapolo / pega_umquetenha
Created March 2, 2010 16:51
Pega umquetenha.org
#!ruby19
# encoding: utf8
# author: rafael polo
# created_at: 02.mar.2010
require 'open-uri'
require 'timeout'
class PegaUmquetenha
@rafapolo
rafapolo / gist:330591
Created March 12, 2010 18:27
twitter social bot
#!ruby19
# encoding: utf8
# author: rafael polo
# created_at 11.mar.2010
# updated_at 12.mar.2010
require File.join(File.dirname(__FILE__), 'Entendedor.rb')
require 'rubygems'
require 'twitter'
@rafapolo
rafapolo / gist:330592
Created March 12, 2010 18:28
entendedor
#!ruby19
# encoding: utf8
# author: rafael polo
# created_at 11.mar.2010
# updated_at 12.mar.2010
require 'yaml'
class Entendedor