A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| <!-- List tags for product --> | |
| {% if product.tags.size > 0 %} | |
| <div><span class="mellow" >tags:</span> | |
| {% for tag in product.tags %} | |
| <a href="/collections/all/{{ tag | replace: ' ','-' }}">{{ tag }}</a> | |
| {% endfor %} | |
| </div> | |
| {% endif %} |
| """Check the validity of URL for maximum compliance, return "ready to | |
| use" url address (with http:// as needed) on success | |
| Abstract: Be dry. URL verification is a persistent need, this iteration | |
| has been very handy for website use, such as profile creation and seems | |
| to have a near total compliance with the changing URL schemas. | |
| No code is prefect, olease let me know if you find error or have a proposed | |
| patch. |
| [section] | |
| key=value | |
| otherKey=otherValue |
| // class w/construct | |
| var happy = function (msg) { | |
| this.message = msg; | |
| }; | |
| // method | |
| happy.prototype.hello = function(){ | |
| console.log('hi'); | |
| console.log(this.message) | |
| } |
| """because the instructions were not clear to me, if I missed | |
| something or this does not work drop a comment and I will fix. | |
| After figuring this out I just wanted to put the solution | |
| somewhere. Code pulled from working project.""" | |
| from __future__ import print_function | |
| import os, urllib, url | |
| buffer_base_url = 'https://api.bufferapp.com' |
| import calendar | |
| from time import gmtime | |
| print calendar.timegm(gmtime()) | |
| ################################### | |
| # Follow Me on Twitter @datamafia # | |
| ################################### |
| d = dict() | |
| d['a'] = 1 | |
| d.update( | |
| { | |
| 'a': 2 | |
| } | |
| ) | |
| print d |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode. | |
| Usage: | |
| File Encryption: | |
| aescrypt.py [-f] infile [outfile] |