Skip to content

Instantly share code, notes, and snippets.

View codeadict's full-sized avatar
🕸️
λ: f(f(state)) = f(state)

Dairon M. codeadict

🕸️
λ: f(f(state)) = f(state)
View GitHub Profile
@codeadict
codeadict / scp.py
Last active August 29, 2015 14:19
Store Credit Problem from Google Code Jam
def store_credit_problem(credit, items):
"""
@author: Dairon Medina <http://github.com/codeadict>
My python implementation for Store Credit Problem from Google Code Jam:
http://code.google.com/codejam/contest/351101/dashboard#s=p0
@param credit: integer representing store credit
@param items: list of product prices, must be integers
@returns: tuple with the two prices that consumes the whole credit
@codeadict
codeadict / helpers.py
Created August 28, 2014 16:54
Verificacion de RUCS y Cedulas Ecuador
def check_ruc_private(self, ruc):
"""
Aloritmo para verificar RUC de Empresa Privada.
"""
try:
if (int(ruc[0] + ruc[1])) < 23:
prueba1 = True
else:
prueba1 = False
@codeadict
codeadict / dabblet.css
Created October 28, 2013 22:13
A "deeper" indented text effect with the :before and :after pseudo-elements.
/**
* A "deeper" indented text effect with the :before and :after pseudo-elements.
*/
html, body {
height: 100%;
}
body {
margin: 0;
@codeadict
codeadict / Valida Cedula
Created June 24, 2013 13:55
Validar cedula Ecuatoriana en un form de DJANGO
def clean_cedula(self):
"""
Valída que sea Correcta la Cédula
"""
ced = self.cleaned_data['cedula']
msg = "La Cédula introducida no es válida"
valores = [ int(ced[x]) * (2 - x % 2) for x in range(9) ]
suma = sum(map(lambda x: x > 9 and x - 9 or x, valores))
veri = 10 - (suma - (10 * (suma / 10)))
if int(ced[9]) == int(str(veri)[-1:]):
@codeadict
codeadict / dabblet.css
Created June 21, 2012 17:57
Based on email I got from andrea ricci
/* Based on email I got from andrea ricci */
a[href^="mailto:"]:before { content: "\2709"; }
.phone:before { content: "\2706"; }
.important:before { content: "\27BD"; }
blockquote:before { content: "\275D"; }
blockquote:after { content: "\275E"; }
.alert:before { content: "\26A0"; }
:before, :after {