This file contains 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
#ifndef GHETTO_RETRY_H | |
#define GHETTO_RETRY_H | |
template<typename TEx, TCall> | |
void ghettoRetry(TCall call, int count = 1) { | |
// Retry count number of times | |
// Note the last one will throw on failure | |
for (int i = 0; i < count - 1; i += 1) { | |
try { | |
call(); |
This file contains 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
#include <iostream> | |
using std::cout; | |
using std::endl; | |
class Range { | |
public: | |
explicit Range(int endValue) : start(0), endValue(endValue) { } | |
Range(int start, int endValue) : start(start), endValue(endValue) { } |
This file contains 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 contextlib | |
import collections | |
import mock | |
import sys | |
def fake_module(**args): | |
return (collections.namedtuple('module', args.keys())(**args)) | |
def get_patch_dict(dotted_module_path, module): | |
patch_dict = {} |
This file contains 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 random | |
import re | |
simple_word_regex = re.compile('^[a-z]+$') | |
word_list = [] | |
with open('/usr/share/dict/american-english', 'r') as words_file: | |
for word_line in words_file: | |
word = word_line.strip() |
This file contains 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
// ---- | |
// Sass (v3.4.20) | |
// Compass (v1.0.3) | |
// ---- | |
a, b { | |
&:not(c) { | |
d: e; | |
} | |
} |
This file contains 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 argparse | |
import ast | |
import io | |
from Cheetah.compile import compile_source | |
from Cheetah.Template import Template | |
template_self_vars = {var for var in dir(Template) if not var.startswith('_')} |
This file contains 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 pipes | |
import subprocess | |
pythons = ( | |
'Python27', | |
'Python27_x86', | |
'Python34', | |
'Python34_x86', | |
'Python35', |
This file contains 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 argparse | |
import os | |
from pyth.plugins.rtf15.reader import Rtf15Reader | |
from pyth.plugins.plaintext.writer import PlaintextWriter | |
def get_text(filename): | |
with open(filename) as f: | |
doc = Rtf15Reader.read(f) |
This file contains 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
// ==UserScript== | |
// @name gerthurb | |
// @namespace asottile | |
// @include https://*.github.com/* | |
// @include https://github.com/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
document.querySelector('.header-dark').classList.remove('header-dark'); |
This file contains 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 pprint | |
def ntpp(x, *, l=0): | |
indent = l * 4 * ' ' | |
if hasattr(x, '_fields'): | |
return ''.join(( | |
type(x).__name__ + '(\n', | |
*( | |
indent + ' ' + |
OlderNewer