Skip to content

Instantly share code, notes, and snippets.

View apg's full-sized avatar
🐢
Turtle

Andrew Gwozdziewycz apg

🐢
Turtle
View GitHub Profile
@apg
apg / ded.clj
Created August 24, 2011 12:19 — forked from alandipert/ded.clj
Command-line structural data editing
(ns ded
"Structural Data EDitor for Clojure with zippers. Inspired by Interlisp: http://larry.masinter.net/interlisp-ieee.pdf"
(:require [clojure.zip :as z])
(:use [clojure.pprint :only (with-pprint-dispatch code-dispatch pprint)]
[clojure.repl :only (source-fn)]))
(defn print-hr
"Prints 30 dashes and a newline."
[c]
(println (apply str (repeat 30 c))))
@apg
apg / gist:1163722
Created August 22, 2011 21:55 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job: Software Engineer at Meetup
Favorite Python project: nyanbar (https://github.com/apgwoz/nyanbar)
Favorite Conference: I don't go to many conferences. Clojure Conj was great last year.
Python Experience Level: Experty
@apg
apg / wtf8.py
Created August 19, 2011 14:09 — forked from philikon/wtf8.py
WTF-8 codec for Python
# wtf8.py
import codecs
def encode(input, errors='strict'):
return input.encode('utf-8', errors).decode('latin-1', errors).encode('utf-8', errors), len(input)
def decode(input, errors='strict'):
return input.decode('utf-8', errors).encode('latin-1', errors).decode('utf-8', errors), len(input)
class StreamWriter(codecs.StreamWriter):
@apg
apg / gist:1147620
Created August 15, 2011 19:50 — forked from pkazmier/gist:1147588
orbitz erc-minor-mode has been revived!!
;; orbitz Mode
;; Need to add the ERC hook in emacs for it to work:
;; (add-hook 'erc-send-pre-hook 'erc-maybe-orbitz)
(define-minor-mode erc-orbitz-mode
"Toggle automatic orbitzing everything you type in ERC."
nil " orbitz")
(defun erc-maybe-orbitz (ignore)
"Change the text to orbitz text, if `erc-orbitz-mode' is non-nil."
@apg
apg / rapture.js
Created May 21, 2011 15:06 — forked from jgv/rapture.js
Is it the rapture yet?
(function () {
// no point in having the function take only a day, or
// having a function at all for that matter...
var date = new Date();
if (date.getDate() === 21 &&
date.getMonth() === 4 &&
date.getFullYear() === 2011) {
document.write('its the rapture');
} else {
from functools import wraps
def jsonp(view_func):
"""Wrap a json response in a callback, and set the mimetype (Content-Type) header accordingly
(will wrap in text/javascript if there is a callback). If the "callback" or "jsonp" paramters
are provided, will wrap the json output in callback({thejson})
Usage:
@jsonp
@apg
apg / gist:657226
Created October 31, 2010 22:09 — forked from lancepantz/gist:654709
# I use this on Linux:
#!/bin/bash
# e - launch emacsclient or server.
ps ax | grep "emacs --daemon" | grep -v "grep"
if [ "$?" -eq "1" ]
then
/usr/bin/emacs --daemon
fi