This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
Save books out of Safari Books Online
From http://objectivesea.tumblr.com/post/9033067018/safaribooks
This is hard. I spent way too much time figuring this out, because I was annoyed that a book I bought (Addison-Wesley) was available online for free, except only for 45 days after which payment was required. So I made this hack... probably useful to no one else, but here it is.
Requirements:
| from __future__ import with_statement | |
| from google.appengine.ext import db, blobstore | |
| from google.appengine.api import memcache, files, images | |
| class Photo(db.Model): | |
| created = db.DateTimeProperty(auto_now_add=True) | |
| updated = db.DateTimeProperty(auto_now=True) | |
| blob_key = blobstore.BlobReferenceProperty() | |
| url = db.StringProperty() | |
| thumbnail_url = db.StringProperty() |
| .fb_access_token | |
| .fbconsole.py |
| #!/usr/bin/env python | |
| import os | |
| import os.path | |
| import json | |
| import re | |
| from mimetypes import guess_type | |
| from optparse import OptionParser | |
| SUPPORTED_TYPES = ('image/gif','image/jpeg','image/png','image/bmp','image/tiff') |
| from pyparsing import * | |
| # By default, PyParsing treats \n as whitespace and ignores it | |
| # In our grammer, \n is significant, so tell PyParsing not to ignore it | |
| ParserElement.setDefaultWhitespaceChars(" \t") | |
| def parse(input_string): | |
| def convert_prop_to_dict(tokens): | |
| """Convert a list of field property tokens to a dict""" | |
| prop_dict = {} |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/ | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| #!/usr/bin/env python | |
| ''' | |
| This is an attempt of an alternative to | |
| http://code.activestate.com/recipes/577068-floating-point-range/ | |
| but generating the expected floating-point elements in the range, | |
| avoiding floating-point arithmetic problems. | |
| Currently it works rather well, although without the original | |
| validation steps (which seem to be overengineering to me), considering |
| OK, Let's begin. Hello, Everybody. | |
| My name is Narihiro Nakamura. | |
| Today, I'm talking about "Parallel worlds of CRuby's GC". | |
| I'm very happy now, because I'm meeting attendee in rubyconf. | |
| And, one of my dreams is to talk in rubyconf. | |
| So, I'm very happy and exciting. | |
| Today is my first presentation in English. | |
| My English is not good. |