Skip to content

Instantly share code, notes, and snippets.

View rg3915's full-sized avatar
🏠
Working from home

Regis Santos rg3915

🏠
Working from home
View GitHub Profile
@rg3915
rg3915 / anp_crawler.py
Created December 1, 2015 01:45 — forked from luzfcb/anp_crawler.py
Implementação simples de um Crawler pra extrair dados do site a ANP
# coding=utf-8
"""
**Implementa um Webcrawler para extracao de dados da pesquisa de media de precos realizada periodicamente pela ANP**
Desenvolvido por Fabio C. Barrionuevo da Luz. - 2013
Simple crawler to ANP site
Copyright (C) 2013 Fabio C. Barrionuevo da Luz.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
@rg3915
rg3915 / colorbrewer.js
Last active March 17, 2018 02:09 — forked from MaxMorais/colorbrewer.js
D3 colorbrewer.js
// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
var colorbrewer = {YlGn: {
3: ["#f7fcb9","#addd8e","#31a354"],
4: ["#ffffcc","#c2e699","#78c679","#238443"],
5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
},YlGnBu: {
@rg3915
rg3915 / bootstrap.sh
Created January 16, 2016 14:34 — forked from cuducos/bootstrap.sh
Computer Bootstraps
#!/bin/bash
##############################################################################
# Install system packages #
##############################################################################
# if apt-get exists, probably it's a Linux
if which apt-get > /dev/null; then
# update & clean up
@rg3915
rg3915 / forms.py
Created February 29, 2016 05:33 — forked from neara/forms.py
Django Class Based Views and Inline Formset Example
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
from models import Sponsor, Sponsorship
class SponsorForm(ModelForm):
class Meta:
model = Sponsor
@rg3915
rg3915 / tree.py
Last active March 17, 2018 02:06 — forked from lffsantos/tree.py
tree.py
from collections import defaultdict
import copy
import csv
import json
from urllib.parse import urlparse
def parser_urls(urls, orig={}):
'''
recebe uma lista de urls e vai parseando enquanto essa tiver um diretorio
@rg3915
rg3915 / setup.sh
Last active March 9, 2016 18:12 — forked from Benedikt1992/setup.sh
Setup apache-2.4.16 + php-5.6.11 on CentOS 6.7
#!/usr/bin/env bash
# Install dependencies
yum update -y
yum install -y gcc apr-devel apr-util-devel openssl-devel pcre-devel libxml2-devel libcurl-devel
mkdir setup && cd setup
wget wget https://olex-secure.openlogic.com/content/private/5e6a6f0815e830bba705e79e4a0470fbee8a5880//olex-secure.openlogic.com/httpd-2.4.16.tar.gz
tar -xvf httpd-2.4.16.tar.gz
@rg3915
rg3915 / gist:21b547711d65c8fae432f11104748ef2
Created August 23, 2016 16:42 — forked from edmondburnett/gist:40e7db34416fdc734846
Push-to-Deploy, Python edition - git post-receive hook script
#!/usr/bin/env python
# post-receive hook for git-based deployments
# https://edmondburnett.com/post/python-push-to-deploy
import sys
import os
from subprocess import call
# configuration
deploy_to_path = '/path/to/deploy/directory/'
@rg3915
rg3915 / Django + Ajax dynamic forms .py
Created March 23, 2017 18:14 — forked from goldhand/Django + Ajax dynamic forms .py
Django form with Ajax. A simple Task model that can be updated using a CBV with an AJAX mixin. The view sends post data with ajax then updates the view with a callback to a DetailView with a json mixin.There is an abstract CBV, AjaxableResponseMixin, based on the example form django docs, that is subclassed in the TaskUpdateView CBV. TaskUpdateV…
#models.py
class Task(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
def __unicode__(self):
return self.title
@rg3915
rg3915 / var-let-const.md
Last active April 4, 2017 23:25 — forked from vinicius73/var-let-const.md
var, let e const no JavaScript

var,let, const

Em JavaScript há uma comportamento chamado hoisting. O uso de var trazia algumas pegadinhas, como por exemplo, declarar a mesma variável 2x usando var

var abc = 25
// ...
// ...
var abc = 99
@rg3915
rg3915 / filter_jquery_element.js
Last active January 31, 2019 10:09 — forked from olivx/filter_jquery_element.js
Filter elements with jQuery - Search (dataTable)
function filter(element, selector) {
var value = $(element).val().toUpperCase();
$(selector +" li").each(function () {
if ($(this).text().toUpperCase().indexOf(value)> -1) {
$(this).show();
} else {
$(this).hide();
}
});
}