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
# create symlink to solve missing directory on mountain lion | |
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain | |
# install mod with brew | |
brew install mod_wsgi | |
# add this line to httpd.conf and restart apache | |
LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.3/libexec/mod_wsgi.so | |
sudo apachectl restart |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Blue Component</key> | |
<real>0.0</real> | |
<key>Green Component</key> | |
<real>0.0</real> |
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 Bar(object): | |
def __init__(self, bar='bar', *args, **kwargs): | |
self.bar = bar | |
super(Bar, self).__init__(*args, **kwargs) | |
class Foo(object): | |
def __init__(self, foo='foo', *args, **kwargs): | |
self.foo = foo | |
super(Foo, self).__init__(*args, **kwargs) |
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
#include <stdio.h> | |
#include <malloc.h> | |
void value_swap(int, int); | |
void reference_swap(int*, int*); | |
void memory_swap(int*, int*); | |
int main(int argc, char **argv) | |
{ | |
int* a = malloc(sizeof(int)); |
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
Originally: | |
https://gist.github.com/7565976a89d5da1511ce | |
Hi Donald (and Martin), | |
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I | |
appreciate the tone. This is a Yegge-long response, but given that you and | |
Martin are the two people best-situated to do anything about this, I'd rather | |
err on the side of giving you too much to think about. I realize I'm being very | |
critical of something in which you've invested a great deal (both financially |
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
# Oh yeah these and print anything with a __str__, right? | |
string_formating = 'This is not cool %s' | |
format_string = 'This is very cool {}' | |
# Wrong, wrong, wrong... | |
input = ('since', 'I', 'can', 'do', 'this') | |
print format_string.format(input) |
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
Unobvious error using Python2.7 and CherryPy | |
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond | |
response.body = self.handler() | |
File "/usr/local/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__ | |
self.body = self.oldhandler(*args, **kwargs) | |
File "/usr/local/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__ | |
return self.callable(*self.args, **self.kwargs) | |
TypeError: logout() got multiple values for keyword argument 'page_url' |
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
Python2 vs Python3 | |
A bug waiting to happen. | |
Python2 | |
>>> x = 1 | |
>>> y = '234' | |
>>> x == y | |
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
A Python bug waiting to happen. | |
>>> x = ['1', '2', '3'] | |
>>> x[:] = x[0] | |
>>> x | |
['1'] | |
>>> x = ['10', '2', '3'] | |
>>> x[:] = x[0] | |
>>> x | |
['1', '0'] |