Skip to content

Instantly share code, notes, and snippets.

except (facebook.GraphAPIError, DrundWorkerError, urllib2.HTTPError), e:
error = 'Unable to retrieve feed.'
if isinstance(e, urllib2.HTTPError):
try:
fb_error = json.loads(e.read())
error = fb_error['error']['message']
if fb_error['error']['type'] == 'OAuthException':
error += ' Please unauthorize Facebook via Settings > Manage Applications and then authenticate again.'
except ValueError:
params = {
'message': 'Hi dude.',
'source': open('filepath.jpg', 'rb')
}
files = {}
for k, v in params.items():
if isinstance(v, file):
files[k] = v
params.pop(k)
{
"keys": ["shift+super+r"],
"command": "show_panel", "args": {"panel": "replace"}
}
{'query': {'normalized': [{'to': 'Stone Cold Steve Austin', 'from': 'Stone_Cold_Steve_Austin'}], 'pages': {'356167': {'lastrevid': 498254288, 'pageid': 356167, 'title': 'Stone Cold Steve Austin', 'starttimestamp': '2012-06-18T23:45:37Z', 'counter': '', 'edittoken': '+\\', 'length': 98448, 'touched': '2012-06-18T23:07:58Z', 'ns': 0, 'revisions': [{'comment': "Reverted 2 edits by [[Special:Contributions/82.12.76.225|82.12.76.225]] ([[User talk:82.12.76.225|talk]]): Linked article on sister project doesn't exist. ([[WP:TW|TW]])", 'timestamp': '2012-06-18T23:07:58Z', 'user': 'Suriel1981', 'revid': 498254288, 'parentid': 498220891}]}}}}
<<class 'requests.cookies.RequestsCookieJar'>[<Cookie centralauth_Session=*** for .wikipedia.org/>, <Cookie centralauth_Token=*** for .wikipedia.org/>, <Cookie centralauth_User=Michaelhelmick for .wikipedia.org/>, <Cookie enwikiUserID=17018417 for en.wikipedia.org/>, <Cookie enwikiUserName=Michaelhelmick for en.wikipedia.org/>, <Cookie enwiki_session=*** for en.wikipedia.org/>]>
@michaelhelmick
michaelhelmick / sublime_text-user_settings.json
Last active February 24, 2017 15:52
My user settings for Sublime Text
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Solarized (Light) (SL).tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fold_buttons": false,
"font_options":
[
"subpixel_antialias"
@michaelhelmick
michaelhelmick / gist:3218930
Created July 31, 2012 17:53
Beautiful Lady

A beautiful lady with eyes on fire,

That sparkle and laugh, that can smile and cry,

I love your eyes so clear and true.

Beautiful lady I adore you.


@michaelhelmick
michaelhelmick / gist:3238281
Created August 2, 2012 16:13
decoder jpeg not available
curl -O http://www.ijg.org/files/jpegsrc.v8c.tar.gz
tar zxvf jpegsrc.v8c.tar.gz
cd jpeg-8c/
./configure
make
make install
pip install -I PIL
{
"error": {
"message": "(#604) Invalid application_id in WHERE clause",
"type": "OAuthException",
"code": 604
}
}
>>> for i in xrange(1, 101):
... if (i%3 == 0) and (i%5 == 0):
... print 'FizzBuzz'
... elif (i%3 == 0):
... print 'Fizz'
... elif (i%5 == 0):
... print 'Buzz'
... else:
... print i
...