Skip to content

Instantly share code, notes, and snippets.

@felipap
felipap / defaultView.js
Created November 10, 2013 18:55
The basic object I use to inherit most of my views in vempraruavem.org from.
var DefaultView = Backbone.View.extend({
btn: $("<div>"),
constructor: function () {
var self = this;
this.btn.click(function () { self.toggle(); });
Backbone.View.apply(this, arguments);
this.$el.on('click', '[data-action=exit]', function () { self.hide(); })
},
show: function () {
this.$el.fadeIn();
@felipap
felipap / events.js
Last active December 29, 2015 17:09
Minimalistic backbone-like Javascript events for light usage.
function implementEvents() {
this._callbacks = {};
this.on = function (eventName, func, t) {
if (typeof func !== 'function')
throw "Invalid argument to .on() "+func
if (this._callbacks[eventName])
this._callbacks[eventName].push(t?func.bind(t):func);
else
this._callbacks[eventName] = [t?func.bind(t):func];
@felipap
felipap / share.js
Created December 4, 2013 00:42
Minimalistic share plugin for http://vempraruavem.org
$.fn.share = function (options) {
// Prevent binding multiple times.
if (this.find('.sn-share-btns').length)
return;
var defOptions = {
trigger: 'hover',
duration: 'fast',
@felipap
felipap / main.json
Created July 12, 2014 21:52
Dump candidatos à presidência, seus vices, ao governo do Rio, e seus vices.
{
"presidente": {
"280000000067": {
"propostas": [
{
"endereco": "http://divulgacand2014.tse.jus.br/divulga-cand-2014/proposta/eleicao/2014/idEleicao/143/UE/BR/candidato/280000000067/idarquivo/152?x=1404936456000280000000067",
"documento": "1 - proposta_governo1404422153496.pdf"
}
],
"genero": "MASCULINO",
@felipap
felipap / server.js
Last active August 29, 2015 14:03
Server using passport to get twitter credentials for an account
passport = require 'passport'
express = require 'express'
app = express()
app.use(require('express-session')({
secret: 'mysecret',
resave: true,
saveUninitialized: true,
}))
@felipap
felipap / foo.py
Created January 9, 2015 06:06
Exploit Ingresso.com
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import urllib.request
base_url = 'http://carrinho.ingresso.com.br/br/compra/ingresso/codbarra/cinema/codbarra_novo.asp?id=00000000000000003620158410000'
base_url = 'http://carrinho.ingresso.com.br/br/compra/ingresso/codbarra/cinema/codbarra_novo.asp?id=0000000000000000 36201%04d 0000'
base_url = 'http://carrinho.ingresso.com.br/br/compra/ingresso/codbarra/cinema/codbarra_novo.asp?id=0000000000000000 361%05d 00000'
'''
Created on 18/06/2010
@author: Felipe
'''
#REMENBER TO COMMENT THE CODE!!!
def separate(eq,G,icox,icoy):
'''Separates the coeficients and sums of both equations and returns'''
#removes the spaces and *s of the equation
eq = eq.replace(' ','').replace('*','')
@felipap
felipap / plugins.js
Last active August 29, 2015 14:15
Plugins! :)
$.fn.sshare = function (options) {
// Prevent binding multiple times.
if (this.find('.sn-share-btns').length)
return;
var defOptions = {
trigger: 'hover',
duration: 'fast',
text: undefined,
@felipap
felipap / cmpSemver.js
Created December 20, 2015 22:22
Compares two semvers.
function cmpSemver(v1, v2) {
if (v1 === "") {
return v2 === "" ? 0 : -1;
} else if (v2 === "") {
return 1;
}
var e1 = v1.match(/^(\d+)\.?(.*)/), e2 = v2.match(/^(\d+)\.?(.*)/);
if (parseInt(e1[1]) === parseInt(e2[1]))
return cmpVersions(e1[2], e2[2]);
return parseInt(e1[1]) > parseInt(e2[1]) ? 1 : -1;
@felipap
felipap / genymotionwithplay.txt
Created March 4, 2016 23:43 — forked from amondnet/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)