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
from collections import namedtuple | |
import timeit | |
import matplotlib.pyplot as plt | |
ComplexityLogEntry = namedtuple('ComplexityLogEntry', ('size', 'time')) | |
class BaseComplexityAssumption(object): | |
title = '' |
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
(ns math-6.core | |
(:require [clojure.math.numeric-tower :refer [abs]])) | |
(def boundaries (range -100 100)) | |
(defn- get-cs-after-second | |
[c-before-before c-before] | |
(when-let [c (mod c-before-before c-before)] | |
(if (zero? c) | |
[0] |
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 | |
class EllipsisPartialTransform(ast.NodeTransformer): | |
def __init__(self): | |
self._counter = 0 | |
def _get_arg_name(self): | |
"""Return unique argument name for lambda.""" | |
try: |
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
from functools import wraps | |
class Partial: | |
def __init__(self, fn, args, kwargs): | |
self._fn = fn | |
self._args = args | |
self._kwargs = kwargs | |
def __call__(self, replacement): |
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 pyparsing as pp | |
token = pp.Word(pp.alphanums + '_-.') | |
command = pp.OneOrMore(token) | |
separators = ['1>>', '2>>', '>>', '1>', '2>', '>', '<', '||', | |
'|', '&&', '&', ';'] | |
separator = pp.oneOf(separators) |
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
from google.appengine.api import datastore_types | |
from mock import patch | |
from freezegun import freeze_time as _freeze_time | |
from freezegun.api import FakeDatetime | |
class freeze_time(object): | |
def __init__(self, *args, **kwargs): | |
self._gae_patch = patch( | |
'google.appengine.ext.db.DateTimeProperty.data_type', |
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
local ret_status="%(?:%{$fg_bold[white]%}🔧 :%{$fg_bold[red]%}🗡 %s)" | |
PROMPT='%{$fg_bold[green]%}%p%{$fg[cyan]%}%c $(git_prompt_info)$(virtualenv_prompt_info)% ${ret_status} %{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_colori%}" | |
ZSH_THEME_VIRTUALENV_PREFIX="%{$fg_bold[blue]%}" | |
ZSH_THEME_VIRTUALENV_SUFFIX="%{$reset_color%} " |
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
from io import BytesIO | |
from PIL import Image, ImageDraw, ImageFont | |
import requests | |
def get_x(img, draw, font, text): | |
img_w, _ = img.size | |
text_w, _ = draw.textsize(text, font=font) | |
return int((img_w - text_w) / 2) |
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
(ns ^:figwheel-always rerenderer.examples.core | |
(:require [rerenderer.core :as r :include-macros true] | |
[rerenderer.browser :refer [interprete]])) | |
(enable-console-print!) | |
(def scene (.. js/window -location -hash)) | |
(defn render! | |
[canvas-id] |
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
(ns parsy.background.core | |
(:require-macros [cljs.core.async.macros :refer [go go-loop]]) | |
(:require [cljs.core.async :refer [chan <! >! merge]] | |
[cljs-time.core :refer [days plus after?]] | |
[cljs-time.format :refer [formatter parse unparse]])) | |
(enable-console-print!) | |
; Map of tab-id => chan | |
(def waiting (atom {})) |