Skip to content

Instantly share code, notes, and snippets.

View jorgebastida's full-sized avatar

Jorge Bastida jorgebastida

View GitHub Profile
@jorgebastida
jorgebastida / facebook_grequests.py
Created August 20, 2012 22:20
grequests facebook company scrapper
import grequests
TOKEN = '<TOKEN>'
ENDPOINT = ('https://api.facebook.com/method/fql.query?query=SELECT+'
'page_url,fan_count,location,products,description,'
'company_overview,general_info,website,founded,'
'mission+FROM+page+WHERE+%(query)s&'
'access_token=%(token)s&format=json')
@jorgebastida
jorgebastida / gist:3127916
Created July 17, 2012 08:09
enjoydjango/dwitter steps diff
Step #1 - views https://github.com/enjoydjango/dwitter/compare/step-00-startproject...step-01-views
Step #2 - templates https://github.com/enjoydjango/dwitter/compare/step-01-views...step-02-templates
Step #3 - tags https://github.com/enjoydjango/dwitter/compare/step-02-templates...step-03-tags
Step #4 - filters https://github.com/enjoydjango/dwitter/compare/step-03-tags...step-04-filters
Step #5 - inheritance https://github.com/enjoydjango/dwitter/compare/step-04-filters...step-05-inheritance
Step #6 - models https://github.com/enjoydjango/dwitter/compare/step-05-inheritance...step-06-models
Step #7 - database https://github.com/enjoydjango/dwitter/compare/step-06-models...step-07-database
Step #8 - tweetpage https://github.com/enjoydjango/dwitter/compare/step-07-database...step-08-tweetpage
Step #9 - profile https://github.com/enjoydjango/dwitter/compare/step-08-tweetpage...step-09-profile
Step #10 - followers https://github.com/enjoydjango/dwitter/compare/step-09-profile...step-10-followers
{% extends "website/base.html" %}
{% block content %}
<h2><!-- @USUARIO --> </h2>
<div id="bio"><em> <!-- BIO --> </em></div>
<br/>
<ul>
<!-- TWEETS -->
</ul>
@jorgebastida
jorgebastida / gist:2623192
Created May 6, 2012 16:32
enjoydjango - Diccionario Tweets
tweets = [
{'user_name':'jorgebastida', 'message': 'Hello world!', 'timestamp': datetime.now()},
{'user_name':'jaimeirurzun', 'message': 'I like ponies! http://djangopony.com', 'timestamp': datetime.now()},
{'user_name':'jorgebastida', 'message': 'Django RULEZZZZZZ', 'timestamp': datetime.now()}
]
@jorgebastida
jorgebastida / trash.txt
Created May 6, 2012 14:47
enjoydjango - Ejercicio Python - input
3-0:]|_3]220()3[31:6_75)[940-_87::[8_].7_:-)(6)21_.9144202(6.-]64[_]3][_2(]37)1[3.8344(65[61:_019_1]_0]()54.7)513]:..)2527071-(3)3)6:)].5[(:81]5)-44[_7(_1_384]:|_0-]|0-(7].2)|_13.(5-|||0(4|].13]4[.0]20|3.]26547[]5||22)-.58]5012|3.3:3]61):856:)])699753[-483606:421)|:._565(5]|8705.7(0964--.-300]:975.44--]-70)33(40-]|-2:_)]8[:2_-185|310])([:8(.6_85.|2|34])08]071|_835[0[-3]696|.:0:(_04.14459).2_67_[9-.[(]0(|36799)320[[(]7)6]0]|[0[[:6(1]--6979.]81_08:2_335_..82)[[__9(7|]9].766|326790-55[8.272_]37:|::(:8554(91|4_9)9-29)_.-9)7|.-.])((:364-8(8868|9)86]|[40__70(426[8(8-:|8--9:6|8-(8_][]5(_--:4:[2620[13|.87:.]-20_2|5--7.-9-[1(2-88564(-2.)4.:8..(-95|[2[0205(||2(:8_)0)66:_8_:92|29:_7-_[[4](3(1-96(.|)(07[5_:(07)2-.)()(42|29.|04.0-6)502|3_|)3|90.7[-)7[.5-0401-|[7:)0:94)1[710)9:33)_|3-)5:[(|736036|7[5883]3--||7.[.7276(92-7986.7(((-_|4726]|([.()-7)0:6(9-111_7||[4)9144[|130137]:80.2|:(_]3[9(3-15-)0.9).043:05_8(:_).|01(_1:418]59]50)0.1_)2--9:636|[71891-(2(622.](79-|([05).7-:99()][8:.652(169]|5500.7(.:1|)])3_--._2)[)8006.]7(]0[
@jorgebastida
jorgebastida / ejercicio_resuelto_awesome.py
Last active October 4, 2015 10:38
enjoydjango - Ejercicio Resuelto Awesome
#!/usr/bin/env python
import urllib2
import re
URL = "https://gist.github.com/jorgebastida/2622704/raw/b264cf36cace951cd1ab32c1a783c0c26ff28545/trash.txt"
print sum(map(int, re.sub("\D", "", urllib2.urlopen(URL).read())))
@jorgebastida
jorgebastida / ejercicio_resuelto.py
Last active October 4, 2015 10:38
enjoydjango - Ejercicio Resuelto
#!/usr/bin/env python
import urllib2
URL = "https://gist.github.com/jorgebastida/2622704/raw/b264cf36cace951cd1ab32c1a783c0c26ff28545/trash.txt"
def es_digito(num):
return num in "0123456789"
@jorgebastida
jorgebastida / ejercicio.py
Last active October 11, 2015 17:58
enjoydjango - Ejercicio Python
#!/usr/bin/env python
"""
Objetivo ....: Mostrar por pantalla el resultado de sumar
todos los digitos contenidos en el fichero
remoto apuntado por la variable URL
Sugerencias .: map(), filter(), int(), sum()
"""
@jorgebastida
jorgebastida / ejemplo.py
Last active October 11, 2015 17:56
enjoydjango - Ejemplo Python
#!/usr/bin/env python
def leer_fichero(nombre_fichero):
fichero = open(nombre_fichero)
contenido = fichero.read()
fichero.close()
return contenido
#
# Comienzo del programa
# Project Page: https://github.com/jorgebastida/glue
# command
glue glyphicons/ out --ignore-filename-paddings --namespace= --crop --padding=5 --order=height
# output png
http://dl.dropbox.com/u/567726/glyphicons.png