Skip to content

Instantly share code, notes, and snippets.

View rochacbruno's full-sized avatar
🛠️
Working on Galaxy_ng and Dynaconf

Bruno Rocha rochacbruno

🛠️
Working on Galaxy_ng and Dynaconf
View GitHub Profile
def guess_time(s):
"""
>>> guess_time('20:00')
(20, 0)
>>> guess_time('23:59')
(23, 59)
>>> guess_time('20:00foo')
(20, 0)
>>> guess_time('9pm')
@rochacbruno
rochacbruno / 1humano.py
Created May 30, 2011 23:43 — forked from douglascamata/1humano.py
Seres humanos comuns e a reprodução desenfreada orientada a objetos
#encoding: utf-8
class Humano(object):
"""Human Being"""
def __init__(self, nome, pai=None, mae=None):
print "alguem fez besteira e colocou mais um ser Humano no mundo \n"
self.nome = nome
self.pai = pai
self.mae = mae
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@rochacbruno
rochacbruno / .gitignore
Created September 6, 2011 21:24 — forked from pcardune/.gitignore
Facebook command-line client helper
.fb_access_token
.fbconsole.py
@rochacbruno
rochacbruno / CSS for <sup> and <sub>
Created October 15, 2011 12:23 — forked from unruthless/CSS for <sup> and <sub>
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@rochacbruno
rochacbruno / Makefile
Created December 5, 2011 00:39 — forked from turicas/Makefile
Create slugs using Python
test:
clear
nosetests --with-coverage --cover-package slugfy test_slugfy.py
clean:
find -regex '.*\.pyc' -exec rm {} \;
find -regex '.*~' -exec rm {} \;
.PHONY: test clean
@rochacbruno
rochacbruno / gist:1797605
Created February 11, 2012 07:52
define_table lazy loaded using class in modules, much more performant then putting in models folder
# modules/tables.py
from gluon.dal import Field
from gluon.validators import *
from gluon.storage import Storage
class Tables(object):
"""Tables stores all dal tables as properties. The properties are lazy loaded so the define_table isn't
Called unless the table is explicitly needed. This also avoids the need to define tables in
a particular order."""
@rochacbruno
rochacbruno / uwsgi.xml
Created February 11, 2012 07:54 — forked from lifeeth/uwsgi.xml
uWSGI config XML
<uwsgi>
<uid>web2py</uid>
<gid>web2py</gid>
<pythonpath>/home/web2py/</pythonpath>
<app mountpoint="/">
<script>wsgihandler</script>
</app>
<mule>run_scheduler.py</mule>
<workers>4</workers>
<pidfile>/tmp/uwsgi-prod.pid</pidfile>
@rochacbruno
rochacbruno / run_scheduler.py
Created February 11, 2012 07:54 — forked from lifeeth/run_scheduler.py
Scheduler process spawning for Web2py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
# Note the app name is hardcoded!
APPLICATION = 'eden'
if '__file__' in globals():
path = os.path.dirname(os.path.abspath(__file__))
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal