Skip to content

Instantly share code, notes, and snippets.

@katspaugh
katspaugh / index.html
Created October 18, 2011 05:10
Saw-pattern borders with canvas
<!DOCTYPE html>
<body style="text-align: center; padding-top: 20px;">
<img src='data:image/jpeg;base64,/9j/4QB1RXhpZgAATU0AKgAAAAgABQEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAExAAIAAAATAAAAWgITAAMAAAABAAEAAAAAAAAAAABIAAAAAQAAAEgAAAABU0ZHYXRlOjpQaXg6OmRFeGlmAP/bAEMACgcHCAcGCggICAsKCgsOGBAODQ0OHRUWERgjHyUkIh8iISYrNy8mKTQpISIwQTE0OTs+Pj4lLkRJQzxINz0+O//bAEMBCgsLDg0OHBAQHDsoIig7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O//AABEIAaECcQMBIgACEQEDEQH/xAAbAAACAwEBAQAAAAAAAAAAAAADBAABAgUGB//EAEQQAAEDAwMCBAMGAwcDAwMFAAECAxEABCESMUEFURMiYXEGMoEUI0JSkaGxwdEHFTNicuHwJDRDU5LxFoKiJURzwtL/xAAYAQADAQEAAAAAAAAAAAAAAAAAAQIDBP/EACIRAQEBAQADAAMAAwEBAAAAAAABEQISITEDQVETYXEiMv/aAAwDAQACEQMRAD8A+ckCJNbSCrZM+1E0yQQPSq0idoV3rdkEtCSSFD60JVuOKaCVTJAV6xV6ETAVHpU4crmqaUk4xWBIOeK6ZQlWFCfWsqtgtOCCaDlIJdUlJnPpW/Ko7QY3orlqoHIM+lCUyoKmPaKAopUU5INYWykyIia2gEEDO1aTkwY9CDQCqmZOANqrzpV5FEU3pnIJzuaotqjIkdxvQNLh2T50fUVtCAsShW4xUU0PbmKzoUkgH9TSCLSpIlWIqTkiAf2qw6oDSQFjsa2PCVmdHpTlAYEyBk8VUgHKY7UQtrSJ04HIND4nMTj1pmqO3FSIrQjVk
@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 / 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 / waiter.js
Created November 28, 2011 14:26
Collects positional arguments on subsequent calls.
function (fn, ctx, undefined) {
var len = fn.length, args = []
return function () {
var complete = true
for (var i = 0; i < len; i++) {
var arg = arguments[i]
if (undefined !== arg) {
@katspaugh
katspaugh / index.html
Last active September 30, 2015 05:28
Stripes
<!DOCTYPE html>
<div style="width: 100%; height: 500px;"></div>
<script src="stripes.js"></script>
<script src="init.js"></script>
@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)

/*
5..times(
function onEach() { blobColl.split(); },
1000,
function onComplete() {
for (var i = 0; i < blobColl.blobs.length; i += 1) {
blobColl.blobs[i].drawCustomFace = BlobFaces[i];
}
@katspaugh
katspaugh / backtrace.el
Created May 6, 2013 07:18
auto-complete backtrace
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p \.\.\.)
*(\.\.\. 5.602796406145941e-09)
(+ score (* (aref stat p) r))
(setq score (+ score (* (aref stat p) r)))
(while (< p --cl-var--) (setq x (max (- b) (min b (- d (abs (- prefix p)))))) (setq r (/ 1.0 (1+ (exp (* (- a) x))))) (setq score (+ score (* (aref stat p) r))) (setq p (+ p 1)))
(let* ((p 0) (--cl-var-- (length string)) (a 5) (b (/ 700.0 a)) (d (/ 6.0 a)) (x nil) (r nil)) (while (< p --cl-var--) (setq x (max (- b) (min b (- d (abs (- prefix p)))))) (setq r (/ 1.0 (1+ (exp (* (- a) x))))) (setq score (+ score (* (aref stat p) r))) (setq p (+ p 1))) nil)
(progn (let* ((p 0) (--cl-var-- (length string)) (a 5) (b (/ 700.0 a)) (d (/ 6.0 a)) (x nil) (r nil)) (while (< p --cl-var--) (setq x (max (- b) (min b (- d (abs ...))))) (setq r (/ 1.0 (1+ (exp (* ... x))))) (setq score (+ score (* (aref stat p) r))) (setq p (+ p 1))) nil))
(progn (progn (let* ((p 0) (--cl-var-- (length string)) (a 5) (b (/ 700.0 a)) (d (/ 6.0 a)) (
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 / git-opendiff
Created August 20, 2013 13:49
git-opendiff
#!/bin/sh
#
# This script was written by Toby White under an unknown license, and published
# on the Git mailing list:
#
# http://kerneltrap.org/mailarchive/git/2007/11/21/435536
#
# Superficial changes were made by Nathan de Vries to allow the script to be
# run under Leopard.
#