Setup homebrew:
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
Then:
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
import requests | |
parts = { | |
'GRAY': 'ME344LL/A', | |
'SILVER': 'ME345LL/A' | |
} | |
url_template = 'http://store.apple.com/us/retail/availabilitySearch?parts.0={}&zip={}' | |
def send_notice(): | |
pass |
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
import collections | |
def extract_top_ten(str): | |
return collections.Counter(str.split()).most_common(10) |
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 AccountEvent(object): | |
def __init__(self, request, user): | |
self.user = user | |
self.request = request | |
class SignupEvent(AccountEvent): | |
pass | |
class LoginEvent(AccountEvent): | |
pass |
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
@view_config(route_name='my-route') | |
def my_view(request): | |
# here i want to know if path-1 or path-2 was taken, preferably via a var n matchdict? | |
if request.matched_route.name == 'my-route2': | |
# do extra work | |
config.add_route('my-route', '/path-1/view') | |
config.add_route('my-route2', '/path-2/view') |
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
from cornice.resource import resource | |
def dbresource(**kw): | |
"""Class decorator to declare CRUD classes. | |
""" | |
def wrapper(klass): | |
setattr(klass, kw.pop('mapping')) | |
setattr(klass, kw.pop('session')) | |
setattr(klass, kw.pop('match_key', 'id')) | |
setattr(klass, kw.pop('primary_key', 'id')) |
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
trial_length = forms.IntegerField(widget=forms.TextInput(attrs={'size': '3', 'maxlength': '2'}), label='Number of days in Trial period', required=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
import os | |
from setuptools import setup, find_packages | |
version=__import__('django_pyres').__version__ | |
def read(fname): | |
return open(os.path.join(os.path.dirname(__file__), fname)).read() | |
setup( | |
name='django-pyres', | |
version=version, | |
description='django pyres integration', | |
long_description=read('README.md'), |
Download Xcode from the mac app store
Setup homebrew_:
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
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
import venusian | |
class route(object): | |
venusian = venusian | |
def __init__(self, name, url): | |
self.name = name | |
self.url = url |