“Conectándose para una mejor salud materno-infantil en el Perú”
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread | |
import cProfile | |
import pstats | |
def enable_thread_profiling(): | |
'''Monkey-patch Thread.run to enable global profiling. | |
Each thread creates a local profiler; statistics are pooled | |
to the global stats object on run completion.''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus gravida, nisl consectetur dignissim euismod, ante tortor rutrum libero, ac euismod mauris elit non augue. Morbi vel placerat mi. In enim metus, commodo nec adipiscing eget, vestibulum ut turpis. In lacinia justo sit amet erat tristique in pharetra nisl condimentum. Vivamus at diam ac nibh placerat egestas id sit amet velit. Mauris sed enim eu metus congue hendrerit. Duis sem nibh, rutrum venenatis pretium eget, auctor sit amet odio. Vivamus nisl ligula, interdum vitae scelerisque et, feugiat quis ipsum. Morbi vel dolor ut nunc pharetra placerat. Pellentesque id quam lacus, ut placerat purus. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def timeit(fn): | |
def time_fn(*arg, **kw): | |
import time | |
now = time.time() | |
fn(*arg, **kw) | |
total = time.time() - now | |
print "total time for %s: %d" % (fn.__name__, total) | |
return time_fn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getScrollBarDimensions() { | |
var elm = document.documentElement.offsetHeight ? document.documentElement : document.body, | |
curX = elm.clientWidth, | |
curY = elm.clientHeight, | |
hasScrollX = elm.scrollWidth > curX, | |
hasScrollY = elm.scrollHeight > curY, | |
prev = elm.style.overflow, | |
r = { vertical: 0, horizontal: 0 }; | |
if ( !hasScrollY && !hasScrollX ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -n "$1" ] | |
then | |
ps xu | grep $1 | awk '{print $2}' | xargs kill -9 | |
else | |
echo "Usage: die <process-name>" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dev | |
django-debug-toolbar==0.9.4 | |
django-data-tools==0.1 | |
django-devserver==0.3 | |
nashvegas==0.8-disqus-5 | |
Sphinx>=1.0.7 | |
piplint==0.1.1 | |
# global | |
amqplib==1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Persona | |
{ | |
public $nombres = ''; | |
public $ape_paterno = ''; | |
public $ape_materno = ''; | |
public $edad = null; | |
public function ponerNombresApellidos($nombres, $ape_pat, $ape_mat) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
URL = 'http://api.tropo.com/1.0/sessions' | |
TOKEN = '' | |
def send_sms(to, shout): | |
params = urllib.urlencode({ | |
'action': 'create', | |
'token': TOKEN, | |
'shout': shout, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xlwt | |
from django.http import HttpResponse | |
def export_xls(modeladmin, request, queryset): | |
meta = modeladmin.model._meta | |
filename = '%s.xls' % meta.verbose_name_plural.lower() | |
def get_verbose_name(fieldname): | |
name = filter(lambda x: x.name == fieldname, meta.fields) |