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 copy | |
x = [257, 258, 259] | |
y = copy.deepcopy(x) | |
z = [257, 258, 259] | |
header = [('', 'x', 'deepcopy(x)', 'z')] | |
rows = [(i, id(i), id(j), id(k)) for i, j, k, in zip(x, y, z)] | |
for cols in header + rows: |
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 util = require('util'); | |
var xmlrpc = require('xmlrpc'); | |
var Serializer = require('xmlrpc/lib/serializer'); | |
function DoubleType(raw) { | |
xmlrpc.CustomType.call(this, raw); | |
} | |
util.inherits(DoubleType, xmlrpc.CustomType); | |
DoubleType.prototype.tagName = 'double'; |
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 dict_contains_subset(superset, subset): | |
for key, value in subset.iteritems(): | |
if key not in superset or superset[key] != value: | |
return False | |
else: | |
return True | |
class SupersetDict(dict): | |
def __contains__(self, other): |
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 Assignment(Model): | |
completed_at = Column(DateTime) | |
@hybrid_property | |
def completed(self): | |
return self.completed_at is not None | |
# Note this is a class method | |
@completed.expression | |
def completed(cls): |
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
copy(Array.prototype.slice.call($$('.essays2015-essay')).map(function(e) { var title = $('.essays2015-essay-title', e), content = $('.essays2015-essay-content', e); return '## ' + title.innerText + '\n\n' + content.innerText.replace(/(.)(\n.)/mg, '$1 $2') }).join('\n\n\n')) |
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
// To install, copy script over to new project at scripts.google.com. | |
// Create two folders, Diary and Archive (one may be inside the other). | |
// Configure the constants below (you can find the folder IDs in your address bar at drive.google.com) | |
// Create a new time-driven trigger set to Day timer (Resources > Current project's triggers > Add a new trigger) | |
// For diary entries | |
var DIARY_FOLDER_ID = '<configure me>'; | |
// For empty diary entries cleaned out. | |
// Note: they're not deleted, due to concern of runaway deletion with no backup | |
var DIARY_ARCHIVE_FOLDER_ID = '<configure me>'; |
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
ITERATIONS = 10000 | |
measure = (title, o) -> | |
table = | |
'lodash keys': do -> | |
# lodash keys() | |
begin = performance.now() | |
for i in [1..ITERATIONS] | |
_.keys(o) | |
performance.now() - begin |
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 ast | |
import pyximport; pyximport.install() | |
import fuckitallup | |
def print_eval(s): | |
print s + ':', eval(s) | |
def extract_evals(): | |
with open(__file__) as fp: |
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
nodejs: | |
pkg.installed: | |
version: 'whatevers' |