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
d = dict() | |
d['a'] = 1 | |
d.update( | |
{ | |
'a': 2 | |
} | |
) | |
print d |
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 calendar | |
from time import gmtime | |
print calendar.timegm(gmtime()) | |
################################### | |
# Follow Me on Twitter @datamafia # | |
################################### |
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
"""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' |
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
// class w/construct | |
var happy = function (msg) { | |
this.message = msg; | |
}; | |
// method | |
happy.prototype.hello = function(){ | |
console.log('hi'); | |
console.log(this.message) | |
} |
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
[section] | |
key=value | |
otherKey=otherValue |
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
"""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. |
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
<!-- 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 %} |
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
<?php | |
/* | |
Install this in your theme header.php as the first statement | |
(next line right after the <?php opening tag) | |
Change $magic_word to what ever variable you want to use, | |
default is "preview" | |
To use this, go to yoursite.com?preview and a session will | |
be created and access to the site will last as long as the |
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
#!/usr/bin/env python | |
class A(object): | |
var = 'A' | |
def __init__(self): | |
self.test() | |
def test(self): | |
print 'Class A: '+self.var |
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
#!/usr/bin/env python | |
# Fast and haphazard introduction | |
# to repr in Python | |
g = 'x' | |
print(g) # x | |
# reprESENTATION is if... (terminal) | |
print(repr(g)) # 'x' | |
repr = 'y' |