Skip to content

Instantly share code, notes, and snippets.

View lavarini's full-sized avatar
💭
É bios!

Alexandre Lavarini lavarini

💭
É bios!
  • Studio Sol
  • Belo Horizonte
View GitHub Profile
(function(w, d, s) {
try {
d = w.top.document || d; w = w.top.document ? w.top : w;
} catch (e) {}
var ttag = function() {
var slot;
slot = parent.document.querySelectorAll('#pub_teads');
if (slot.length == 0) {
location ~ ^/(api|ssi)/(?P<api_url>.*) {
set $php_fpm_socket "/var/run/php5.5-fpm-novocifraclub.sock";
root /var/www/NovoCifraClub/src/CifraClub;
index index.php;
include fastcgi_php;
fastcgi_param AMBIENTE 2;
rewrite ^ /index.php?_url=/$api_url break;
}
server {
listen 80 default_server;
server_name megastore.cifraclub.com.br;
rewrite ^ http://www.cifraclub.com.br/megastore_shutdown.php permanent;
#return 301 http://www.cifraclub.com.br/megastore_shutdown.php;
}
@lavarini
lavarini / gist:7159032
Last active December 26, 2015 13:29
Browser scroll - do something
var scrolled, $w = $(window);
$w.on('scroll', function() {
scrolled = true;
});
window.scroll_timeout = setInterval(doSomething, 100);
function doSomething() {
if (!scrolled) {
@lavarini
lavarini / gist:7043827
Created October 18, 2013 16:08
Urllib com proxy
# -*- coding: utf-8 -*-
import urllib2
from bs4 import BeautifulSoup
import re
import time
from StringIO import StringIO
import gzip
def make_request(url):
map $http_host $user_ciframobile {
default "bruno.souza";
"m.bruno.cifraclub.cc" "bruno.souza";
"m.bela.cifraclub.cc" "izabela.bittencourt";
"m.pedro.cifraclub.cc" "pedro.chaves";
"m.lavarini.cifraclub.cc" "alexandre.lavarini";
"m.daniel.cifraclub.cc" "daniel.lima";
"m.samuel.cifraclub.cc" "samuel.vignoli";
}
@lavarini
lavarini / gist:6804200
Created October 3, 2013 03:07
Tentativa =(
# -*- coding: utf-8 -*-
import urllib2
from bs4 import BeautifulSoup
from StringIO import StringIO
import gzip
txheaders = {
'User-agent' : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19" ,
"Referer" : "http://mangafox.me/manga/naruto/",
"Host" : "mangafox.me",
sql_insert = '('
for i in manga['genres']:
id_genre = genres_list.index(i) + 1
sql_insert += "%s, %s),("%(id_manga, id_genre)
sql_insert = sql_insert[:-2]
sql = "INSERT INTO mangafox_genre (id_genre, id_mangafox) VALUES %s"%(sql_insert)
cur.execute(sql)
genres = ['Action','Adult','Adventure','Comedy','Doujinshi','Drama','Ecchi','Fantasy','Genred Bender','Harem','Historical','Horror','Josei','Martial Arts','Mature','Mecha','Mystery','One Shot','Psychological','Romance','School Life','Sci-fi','Seinen ','Shoujo','Shoujo Ai','Shounen','Shounen Ai','Slice of Life','Smut','Sports','Supernatural','Tragedy','Webtoons','Yaoi','Yuri']
$res = $conn->query('
SET @num := 0, @genre := "";
SELECT
id_artista,
artista,
art_url,
genero_url,
genero,
(