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
""" | |
Requests' authenticator that attaches given parameters | |
to the URL query string. | |
License: Public Domain. | |
""" | |
from requests.auth import AuthBase | |
class QueryStringAuth(AuthBase): |
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
function interruptibleFadeOut(element, options) { | |
if (typeof options === 'number') { | |
options = {fadeOut: options}; | |
} | |
element = $(element); | |
return new Promise(function(resolve) { | |
// Event handlers used by the effect. | |
var events = { | |
mouseenter: function() { interruptAnimation(); }, |
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
""" | |
Jinja extension adding support for {% error %} tag | |
that allows to raise exceptions directly from templates. | |
""" | |
from jinja2 import TemplateAssertionError | |
from jinja2.ext import Extension | |
from jinja2.nodes import CallBlock, Const | |
class ErrorExtension(Extension): |
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 python | |
""" | |
{project} | |
====================================== | |
{description} | |
""" | |
import ast | |
import os | |
from setuptools import find_packages, setup |
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 pl.org.xion.taphoo.logic; | |
/** | |
* An utility class to hold ranges of cells' values. | |
* @author Xion | |
*/ | |
final class CellRanges { | |
/** | |
* Private constructor to prevent instantiation. |
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 runhaskell | |
-- Preview structured text files in the browser | |
-- Usage: $ preview FILE [BROWSER] | |
-- by Karol Kuczmarski "Xion" -- 25 August 2013 | |
import Control.Exception (bracket) | |
import System.Environment (getArgs) | |
import System.Directory (getTemporaryDirectory) |
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
#!/bin/sh | |
# git-today | |
# | |
# Usage: | |
# * Name it `git-today` and put somewhere inside a `$PATH` directory | |
# * Invoke as $ git today | |
LAST_BEFORE_TODAY=$(git log --oneline --until='yesterday 23:59:59' | head -1 | cut -d' ' -f 1) | |
git --no-pager diff ${LAST_BEFORE_TODAY}..HEAD --stat |
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 read_requirements(filename='requirements.txt'): | |
"""Reads the list of requirements from given file. | |
:param filename: Filename to read the requirements from. | |
Uses ``'requirements.txt'`` by default. | |
:return: Requirments as list of strings. | |
""" | |
# allow for some leeway with the argument | |
if not filename.startswith('requirements'): |
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
#!/bin/sh | |
# Start a debug SMTP server using Python's smtpd module | |
show() { | |
echo 1>&2 "$@" | |
} | |
port=${1-25} | |
smtpd_args="-c DebuggingServer localhost:$port" |