Skip to content

Instantly share code, notes, and snippets.

View luizfonseca's full-sized avatar
💻
cargo run

Luiz Fonseca luizfonseca

💻
cargo run
View GitHub Profile
@luizfonseca
luizfonseca / js.html
Created May 4, 2012 04:26
Don't ask me why I made this.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>LOL JavaScript</title>
<script type="text/javascript" language="javascript" charset="utf-8">
//<![CDATA[
LOL = {
showMeYourBin: function(string){
@luizfonseca
luizfonseca / .gitconfig
Last active October 1, 2017 21:20
My GitConfig
[user]
name = Luiz Fonseca
email = [email protected]
[alias]
s = !git status
a = !git add . -vA
c = !git commit
gck = !git checkout
l = "log --graph --pretty=\"format:%C(yellow)%h%Cred%d%Creset %s %C(white) %C(cyan)%an%Creset, %C(green)%ar%Creset\""
pom = push origin master
@luizfonseca
luizfonseca / .vimrc
Last active October 4, 2015 11:27
My .vimrcUpdate VIM-SLIM plugin from slim-template/ organization.
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Selfstarter = window.Selfstarter = {
firstTime: true,
value: null,
form: $('#order_form'),
valueField: $('#order_form').find('input[name="order[value]"]'),
email: $('#order_email'),
button: $('#self_button'),
step1: $('.step_1'),
step2: $('.step_2'),
@luizfonseca
luizfonseca / cep.js
Last active December 19, 2015 12:19
// Make a request to a SSL api that returns CEP info
getZipcodeInfo: function(){
var cep = "22245-070"; //OU OUTRO, VINDO DE UM CAMPO, por ex.
$.getJSON('//brazilapi.herokuapp.com/api?cep=' + cep, function(response){
self.populateAddressFields(response[0]);
})
},
@luizfonseca
luizfonseca / Links.md
Last active December 27, 2015 14:49
Links links.
matched_users = []
missing_users = []
matched_subscriptions = []
missing_subscriptions = []
@sheet = JSON.load(open('https://spreadsheets.google.com/feeds/list/0AksoO03hL7CRdGR2eDhmODQ5VVhoX0RBSVNoT1U2Vnc/od6/public/values?alt=json'))
@entries = @sheet['feed']['entry']
@entries.each do |entry|
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
</template>
<script>
DROP FUNCTION IF EXISTS get_category_zone(integer, text);
CREATE OR REPLACE FUNCTION get_category_zone(cat_id integer, zone_id text) RETURNS numeric AS $$
SELECT
SUM(zone_list.count)
FROM (
SELECT
d.id,
d.zone,
(
SELECT COUNT(*)
@luizfonseca
luizfonseca / get_category_zone.sql
Last active August 29, 2015 14:23
Sum of Pins that intersect with the current district on the given category id
DROP FUNCTION IF EXISTS get_category_zone(integer, text);
CREATE OR REPLACE FUNCTION get_category_zone(cat_id integer, zone_id text) RETURNS numeric AS $$
SELECT SUM(zone_list.count) FROM (
SELECT
d.id,
d.zone,
(
SELECT COUNT(*)
FROM pins p0