This file contains hidden or 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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
This file contains hidden or 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
''' | |
If you allways endup googleing how to code down relative paths inside django's | |
settings.py file using the os.path module, you should consider bookmarking this | |
code snippet | |
Usage inside settings.py: | |
SITE_ROOT = site_root_path(__file__) | |
. | |
. | |
. |
This file contains hidden or 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
import difflib | |
# initialize | |
matcher = difflib.SequenceMatcher() | |
ret = ['this', 'is', 'sparta'] | |
rel = ['this', 'here', 'is','not','acutally', 'sparta'] | |
# calculate matching blocks | |
matcher.set_seqs(ret, rel) | |
matches = matcher.get_matching_blocks()[:-1] |
This file contains hidden or 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
root : WARNING no content attribute in meta http-equiv tag in 56062aa5-b833-4f50-a1f0-77e75ca29c2c.html: <meta http-equiv="Content-Type" conte="conte" /> | |
root : WARNING no content attribute in meta http-equiv tag in e3a8cc42-09a1-470a-a705-d1d7dc5afd7a.html: <meta http-equiv="Content-Type" conte="conte" /> | |
root : WARNING no content attribute in meta http-equiv tag in 91f7a641-0abf-4700-9392-56d1cdb9c1f5.html: <meta http-equiv="Content-Type" conte="conte" /> | |
root : WARNING no content attribute in meta http-equiv tag in fc246c87-b4c6-4a7b-a77f-627c7fa18004.html: <meta http-equiv="Content-Type" conte="conte" /> | |
root : WARNING no content attribute in meta http-equiv tag in 09988ff6-80a0-47c4-9b1d-d7861227461b.html: <meta http-equiv="Expires" conten="CONTEN" /> | |
root : WARNING no content attribute in meta http-equiv tag in 3006baa7-a951-4b4f-a692-ce47f746f80e.html: <meta http-equiv="Content-Type" conte="conte" /> | |
root : WARNING no content attribute in meta htt |
This file contains hidden or 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
# we use antrun:run goal and bind it to the generate-sources lifecycle | |
# to generate java source files via thrift compiler | |
$ mvn generate-sources | |
# or just use | |
$ mvn compile |
This file contains hidden or 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
''' | |
Real life logging levels. Use this module instead of built-in logging throughout your project. | |
''' | |
from logging import * | |
fyi = debug | |
ewbte = info # everything went better than expected | |
lolwat = warn | |
omg = error | |
fml = critical |