Skip to content

Instantly share code, notes, and snippets.

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

Leonardo J. Caballero G. macagua

🏠
Working from home
View GitHub Profile
manage.py:4:20: E261 at least two spaces before inline comment
Separate inline comments by at least two spaces.
An inline comment is a comment on the same line as a statement. Inline
comments should be separated by at least two spaces from the statement.
They should start with a # and a single space.
Okay: x = x + 1 # Increment x
Okay: x = x + 1 # Increment x
E261: x = x + 1 # Increment x
@juque
juque / MySQL-Chile:regiones-provincias-comunas
Created July 6, 2010 19:32
Chile: Regiones, Provincias, Comunas
/* Estructura y Datos de las Regiones, Provincias */
/* y Comunas de Chile. */
/* */
/* Fecha: Julio 2010 */
/* Autor: Juan Pablo Aqueveque - juque.cl */
--
-- Comunas
--
DROP TABLE IF EXISTS `comunas`;
# Based on code here: http://westhoffswelt.de/blog/0036_xpath_to_select_html_by_class.html
$x('//a[@class
and (
contains(normalize-space(@class), " q ")
or starts-with(normalize-space(@class), "q ")
or substring(normalize-space(@class), string-length(normalize-space(@class)) - string-length("q")) = " q"
or @class = "q"
)
@tomster
tomster / git-dropbox
Created January 1, 2011 15:40
Create a symlink of the current .git inside your Dropbox, now all your local commits will automatically be backed up to Dropbox (without your dropbox being littered with development cruft, like temporary build files)
#!/usr/bin/env python
# encoding: utf-8
""" Create a symlink of the current .git inside your Dropbox, now all your
local commits will automatically be backed up to Dropbox (without your dropbox
being littered with development cruft, like temporary build files)
"""
from os import getcwd, path, mkdir, symlink, chdir
root@precision:/home/tzury/Desktop# python i18n.py
Te AMO
ERROR:root:i18n.html code:
1 def _execute():
2 _buffer = []
3 _tmp = _("I love you")
4 if isinstance(_tmp, str): _buffer.append(_tmp)
5 elif isinstance(_tmp, unicode): _buffer.append(_tmp.encode('utf-8'))
6 else: _buffer.append(str(_tmp))
7 _buffer.append('\n')
@issackelly
issackelly / gist:928783
Created April 19, 2011 16:48
Django Template {{ block.super }} example
# Template: A.html
<html>
<head></head>
<body>
{% block hello %}
HELLO
{% endblock %}
</body>
</html>
@dsibilly
dsibilly / related_models.py
Created May 11, 2011 20:31
SQLAlchemy related models demo
@wilmoore
wilmoore / convert.sh
Created June 2, 2011 00:29
convert markdown to reStructured Text (Thanks Doctrine2) - https://github.com/doctrine/dbal-documentation/blob/master/convert.sh
#!/bin/bash
FILES=`find -iname *.txt -print`
for FILE in $FILES
do
# replace the + to # chars
sed -i -r 's/^([+]{4})\s/#### /' $FILE
sed -i -r 's/^([+]{3})\s/### /' $FILE
sed -i -r 's/^([+]{2})\s/## /' $FILE
sed -i -r 's/^([+]{1})\s/# /' $FILE
sed -i -r 's/(\[php\])/<?php/' $FILE
@SEJeff
SEJeff / settings_ldap.py
Created July 8, 2011 22:27
Example django_auth_ldap configuration
############################## django-auth-ldap ##############################
import ldap
from django_auth_ldap.config import LDAPSearch, PosixGroupType
# django-auth-ldap configuration starts here
AUTH_LDAP_SERVER_URI = "ldap://ldap.els03.loc ldap://ldap.zbw03.loc ldap://ldap.cvg03.loc"
#AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=People,o=loc"
# JW is in ou=Admin,o=loc so we search over o=loc to find him
AUTH_LDAP_USER_SEARCH = LDAPSearch("o=loc",
@sbp
sbp / OpenSans.css
Created August 1, 2011 13:11
CSS for Open Sans
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
src: local('Open Sans Italic'), local('Open-Sans-Italic'),
url('OpenSans-Italic.woff') format('woff'),
url('OpenSans-Italic.ttf') format('truetype');
}
@font-face {