Skip to content

Instantly share code, notes, and snippets.

if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if [ -f /usr/share/git-core/git-completion.bash ]; then
. /usr/share/git-core/git-completion.bash
fi
if [ -f /usr/share/git-core/git-prompt.sh ]; then
. /usr/share/git-core/git-prompt.sh
@katspaugh
katspaugh / README.md
Last active May 20, 2019 13:36
Yandex.Direct API client (see http://api.yandex.com/direct/)

Usage

Instantiate with a path to the directory containing the SSL certificate and key (issued by Yandex.Direct).

from directmanager import DirectManager

manager = DirectManager('~/.certificates')

manager.set_cid(2139432)

@katspaugh
katspaugh / animate.js
Created November 18, 2011 11:15
Animation with pluggable easing functions.
/**
* Usage:
*
* animate(document.querySelector('#animatedElement'), {
* styles: {
* height: {
* start : 100
* end : 300,
* units : 'px'
* }
@katspaugh
katspaugh / template.js
Created November 17, 2011 10:59
String.prototype.template
String.prototype.template = function (obj) {
return this.replace(
/{{(.+?)}}/g,
function (_, key) { return obj[key] }
)
}
@katspaugh
katspaugh / observer.js
Created July 22, 2011 12:23
Minimal observer, needed too often.
var Observer = (function () {
'use strict';
return {
on: function (event, fn) {
if (!this.handlers) { this.handlers = {}; }
var handlers = this.handlers[event];
if (!handlers) {
handlers = this.handlers[event] = [];
@katspaugh
katspaugh / .vimrc
Created January 18, 2011 01:04
Alphabetically sorted!
set encoding=utf-8 fileencodings=utf-8
syntax on
"syntax sync fromstart
let no_buffers_menu=1
set backspace=indent,eol,start
set history=50
set hlsearch
set incsearch