Skip to content

Instantly share code, notes, and snippets.

View klebervirgilio's full-sized avatar
🎯
Focusing

Kleber Correia klebervirgilio

🎯
Focusing
View GitHub Profile
@serradura
serradura / sinatra_fb_canvas_app.rb
Created June 11, 2011 12:17
Arquivos de Exemplo de como integrar aplicações Ruby ao Facebook
require 'rubygems'
require 'sinatra'
require 'haml'
require 'koala'
enable :sessions
set :facebook, {:app_id => 'Application ID',
:app_secret => 'Application Secret',
:callback_url => 'http://localhost:3000/canvas/'}
import java.util.*;
public class InternationalizationEx
{
public static void main(String[] args)
{
String lang, country;
Locale cLocale;
ResourceBundle msg;
lang = new String("de");
sudo ifconfig en1 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
@serradura
serradura / fgraph.rb
Last active December 10, 2015 00:58 — forked from anonymous/fb_public.rb
Two clients: HGet (easy way to have Net::HTTP responses supports HTTP and HTTPS) and FGraph (shortcut to do Facebook Graph API requests)
# Examples:
# client = FGraph.new("USERNAME")
#
# if you need see response details use:
# client.request # returns a Net::HTTPFound instance, with this you can see the status, headers# Examples:
# client = FGraph.new("USERNAME")
#
# client.data # returns the parsed response body
# if you need an alias to get the api data response, use:
@lucasallan
lucasallan / install_postgis_osx.sh
Created September 6, 2011 21:03 — forked from klebervirgilio/install_postgis_osx.sh
Installing PostGIS on Mac OS X and Ubuntu
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@avdi
avdi / selective_method_import.rb
Created January 16, 2013 06:35
Playing around with selective method import in Ruby
# Generate a module which imports a given subset of module methods
# into the including module or class.
def Methods(source_module, *method_names)
all_methods = source_module.instance_methods +
source_module.private_instance_methods
unwanted_methods = all_methods - method_names
import_module = source_module.clone
import_module.module_eval do
define_singleton_method(:to_s) do
"ImportedMethods(#{source_module}: #{method_names.join(', ')})"
@pelf
pelf / Anonymiser.py
Last active June 16, 2020 15:41
Sublime plugin for anonymising bank statement data
import sublime, sublime_plugin, random, string, re
class AnonymiseCommand(sublime_plugin.TextCommand):
def replacement(self, s):
# Figure out which chars to use
chars = []
if re.search("[a-z]", s):
chars += string.ascii_lowercase
if re.search("[A-Z]", s):
@akitaonrails
akitaonrails / upgrading-vagrant-fusion.mdown
Created October 24, 2013 17:40
Upgrading Vagrant from the default Virtualbox provider to VMWare Fusion on the Mac

I had some headaches yesterday while trying to upgrade to VMWare Fusion with Vagrant.

The steps that work are:

  • export your boxes from Virtualbox to OVA files
  • run 'vagrant destroy' on all your boxes
  • uninstall Virtualbox using the uninstaller script in the installer DMG
  • download VMWare Fusion
  • run 'vagrant plugin install vagrant-vmware-fusion' to install the provider plugin
  • run 'vagrant plugin license vagrant-vmware-fusion license.lic' to install the license you just bought
@zenorocha
zenorocha / multiple-3rd-party-widgets.js
Last active November 14, 2022 12:18
Loading multiple 3rd party widgets asynchronously
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);