๐
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
package tristate | |
import "sync" | |
// State for a tristate cache | |
type State int | |
// cache State contants | |
const ( | |
Miss State = iota |
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
package fun | |
// bufferedSequence | |
type bufferedSeq struct { | |
seq Seq // original Seq | |
buf *[]float64 // shared slice | |
pos int // this pos | |
} | |
// Next implements Seq interface |
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 urllib.parse import urlencode, urlparse | |
def build_url(base: str, *path, qparams: dict=None, trail_slash: bool=False) -> str: | |
''' | |
As close to a generic URL builder for G-API as possible | |
Assumption(s): | |
1. base is a valid URL with an `https` scheme and a valid `netloc` | |
2. path is a variable number of path arguments |
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
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
""" | |
Learning me some context managers | |
""" | |
# NOTE: see also: contextlib.contextmanager | |
class Context(object): |
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
# suffix characters (base 32, sort of) | |
SUFFIX_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" | |
def id18(s: str, *, check_suffix: bool = False) -> str: | |
""" | |
Converts a 15 character Salesforce ID (s) to its 18 character version. | |
If the ID provided has length 18 and check_suffix is True, we will assert | |
that the suffix is correct! |
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
set nocompatible " Use Vim defaults (much better!) | |
set bs=2 " allow backspacing over everything in insert mode | |
set ai " always set autoindenting on | |
set backup " keep a backup file | |
set viminfo='20,\"50 " read/write a .viminfo file, don't store more | |
" than 50 lines of registers | |
set history=50 " keep 50 lines of command line history | |
" 000328 from article in Linux Journal, Apr 2000 | |
set incsearch " searches as you enter the string! | |
set ignorecase " Ignore case in searching for matches set smartcase " Ignore case ONLY if all lower case srch str |
OlderNewer