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
{"kind": "Listing", "data": {"modhash": "0h2ailm0sf73b753219e8695a84f661c5fb5ef47350859c969", "children": [{"kind": "t3", "data": {"domain": "carlcheo.com", "banned_by": null, "media_embed": {}, "subreddit": "programming", "selftext_html": null, "selftext": "", "likes": null, "user_reports": [], "secure_media": null, "link_flair_text": null, "id": "30sz09", "gilded": 0, "archived": false, "clicked": false, "report_reasons": null, "author": "vaguepotato", "num_comments": 127, "score": 698, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2fwo", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 0, "secure_media_embed": {}, "saved": false, "stickied": false, "is_self": false, "permalink": "/r/programming/comments/30sz09/24_years_ago_linus_torvalds_said_linux_is_just_a/", "name": "t3_30sz09", "created": 1427751242.0, "url": "http://carlcheo.com/fascinating-posts-from-tech-founders-who-changed-the-world", "author_flair_text": null, " |
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
"\e[A": history-search-backward | |
"\e[B": history-search-forward | |
set show-all-if-ambiguous on | |
set completion-ignore-case on |
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
# Load the system properties | |
system=[method://java.lang.System.getProperties()] | |
# Define the environment and language based on the system properties, | |
# with sensible defaults. | |
# (these likely came in as -D options on the command line) | |
lang=${system->lang|english} | |
env=${system->env|dev} | |
# Include language based properties |
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 BaseShardedCountModel(BaseModel): | |
# services | |
# - in-memory counts | |
# - getting counter name from entity | |
# - check for transition | |
def counter(self, name): | |
from lib.shardedcounter import Counter | |
return Counter(str(name + '_' + str(self.key().id()))) | |
def getshardedcount(self, name): |
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 json | |
import os | |
import time | |
import requests | |
from PIL import Image | |
from StringIO import StringIO | |
from requests.exceptions import ConnectionError | |
def go(query, path): | |
"""Download full size images from Google image search. |
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
DEV = os.environ['SERVER_SOFTWARE'].startswith('Dev') | |
APP_ID = os.environ['APPLICATION_ID'] | |
def deleteDBandMemcache(): | |
if not DEV and APP_ID.find('test') == -1: | |
# We're not in Kansas anymore. i.e. This is PRODUCTION. | |
# To test in the cloud, the app id must contain 'test'. | |
logging.error('trying to run tests on production server = no beuno') | |
return |
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
// DOM methods & attributes for Document | |
DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | |
DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | |
DEFINE_ATTRIBUTE_EVENT_LISTENER(click); | |
DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu); | |
DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick); | |
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragenter); | |
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover); | |
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragleave); |
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
synonyms = {'scotty': 'dog', 'puppy': 'dog', 'dog': 'dog'} | |
counts = [(2, 'dog'), (2, 'puppy'), (2, 'scotty')] | |
syn_counts = [] | |
for count in counts: | |
syn_counts.append((count[0], synonyms[count[1]])) | |
print syn_counts | |
sum_counts = {} |
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
def deletedbandmemcache(): | |
"""Delete all entities in namespace.""" | |
from google.appengine.api import namespace_manager | |
###################################### | |
""" ####### IMPORTANT ########## """ | |
TESTSPACE = 'test' | |
namespace_manager.set_namespace(TESTSPACE) | |
""" ##### DO NOT DELETE ######## """ | |
###################################### |
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
var devsite = devsite || {}; | |
devsite.devsite = devsite.devsite || {}; | |
$(document).ready(function() { | |
$("a.sign-in-link").bind("mousedown click", devsite.devsite.login); | |
$("a.sign-out-link").bind("mousedown click", devsite.devsite.logout); | |
devsite.devsite.loggedIn(function(d, b) { | |
b ? devsite.devsite.showError("Error while signing in: " + b) : $("#sign-in-io").hasClass("trig") && devsite.reloadWindow() | |
}) | |
}); | |
window.IO_2012 = function() { |
NewerOlder