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
/* 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 { |
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 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:]): |
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
/** | |
* A "deeper" indented text effect with the :before and :after pseudo-elements. | |
*/ | |
html, body { | |
height: 100%; | |
} | |
body { | |
margin: 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
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 |
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 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 | |
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
class DataImportTables < ActiveRecord::Migration | |
def change | |
create_table :imports do |t| | |
t.string :for_model, null: false, default: 'Properties' | |
t.string :name, null: false | |
t.attachment :file, null: false | |
t.references :company, null: false | |
t.timestamps null: false | |
end |
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
class PropertyStatusHistory < ActiveRecord::Migration | |
def change | |
create_table :property_history do |t| | |
t.references :property, index: true, null: false | |
t.references :user, null: false, index: true | |
t.string :status, null: false | |
t.datetime :datetime, null: false | |
end | |
end | |
end |
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
class AddUsStates < ActiveRecord::Migration | |
def up | |
create_table :states do |t| | |
t.string :iso_abbr, unique: true | |
t.string :name | |
t.timestamps | |
end | |
#: insert states here | |
states_data = [ |
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 primesList(N): | |
""" | |
Generates a list of prime numbers from 2 to N. | |
N: an integer | |
""" | |
return [a for a in range(2, N) if not [b for b in range(2,a) if not a%b]] | |
def __main__(): | |
print primesList(100) |
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 currify(func): | |
""" | |
Decorator to curry a function, use it like this: | |
>>> @currify | |
... def sum(a, b, c): | |
... return a + b + c | |
It works on normal way: | |
>>> sum(1, 2, 3) | |
6 | |
And also binding the params: |
OlderNewer