Skip to content

Instantly share code, notes, and snippets.

View zodman's full-sized avatar
🤗
Code wins arguments!

Andres Vargas zodman

🤗
Code wins arguments!
View GitHub Profile
@zodman
zodman / gist:5800585
Created June 17, 2013 21:22
pasword enhanced, stupid whim
def clean_password2(self):
import string
password1 = self.cleaned_data.get("password1", "")
password2 = self.cleaned_data["password2"]
if password1 != password2:
raise forms.ValidationError(_("The two password fields didn't match."))
if len(password2) <6:
raise forms.ValidationError(_("The password must be almost 6 chars"))
digits, chars, punt = set(), set(), set()
@zodman
zodman / pagination.html
Created February 17, 2013 15:30
django paginator + boostrap css
<div class="pagination pagination-centered">
<ul>
{% if page_obj.has_previous %}
<li class="prev">
<a href="{{url_suffix|default:"?page="}}{{page.previous_page_number}}">{{previous_label|default:"&larr; Previous"}}</a>
</li>
{% else %}
<li class="prev disabled">
<a href="#">{{previous_label|default:"&larr; Previous"}}</a>
</li>
@zodman
zodman / console.js
Created January 31, 2013 19:40
para evitar problemas de console.log en ie
if (!window.console) {
window.console = {
log: function() {},
error: function() {},
info: function() {},
warn: function() {}
}
}
@zodman
zodman / granitedemo.py
Created November 14, 2012 00:25
granite-demo in python
import sys
from gi.repository import Gtk, Gdk, GdkPixbuf
from gi.repository import Granite
class DemoApp(Granite.Application):
application_id="demo.granite.org"
program_name="Granite Demo"
app_years= "2012"
build_version="1.0"
main_url = "https://launchpad.net/granite";
@zodman
zodman / requires.txt
Created October 1, 2012 23:36
trytond 2.5 requires
MySQL-python==1.2.4b2
PyWebDAV==0.9.8
cdecimal==2.3
distribute==0.6.28
lxml==2.3.6
polib==1.0.1
psycopg2==2.4.5
pyOpenSSL==0.13
pydot==1.0.28
pyparsing==1.5.6
@zodman
zodman / get_near_point.py
Created September 21, 2012 17:16
Calc the near lat,lng in radius
import random
def get_near_point( lat,lng, radius):
""" http://gis.stackexchange.com/questions/25877/how-to-generate-random-locations-nearby-my-location"""
import math
u = random.random()
v = random.random()
r_d = radius/111300.0
t = 2* math.pi*v
w = r_d * math.sqrt(u)
x = w* math.cos(t)
@zodman
zodman / gist:3723650
Created September 14, 2012 18:13
prestantacion
![tryton img](http://www.tryton.org/img/header.png)
Software libre para empresas
----------------------------
_por @zodman_
!
¿Qué es tryton?
@zodman
zodman / presentation.md
Created September 14, 2012 04:49
tryton presentation

Software libre para empresas

tryton img

¿Qué es tryton?

Tryton ERP. Software Libre para las empresas.

@zodman
zodman / push.js
Created August 20, 2012 23:10
trigger google push event
function trackLink(category, action, opt_label) {
var id = GGANA_GLOBAL_ID;
console.log("track:::", id);
console.log("track:::", category, action, opt_label);
var ret = _gat._getTracker(id)._trackEvent(category, action, opt_label);
console.log("track:::", ret);
}