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
(global-set-key (kbd "ESC M-w") 'gist-region) |
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
(load-file "~/.emacs.d/gist.el/gist.el") | |
(require 'gist) | |
(global-set-key (kbd "ESC M-w") 'gist-region) |
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 | |
# | |
# Converts standard LDIF to a list of dicts | |
# | |
import sys | |
from base64 import b64decode | |
from pprint import pprint | |
SOURCE = "source.ldf" |
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 | |
# | |
# Generates OPML from Mail.app RSS Feeds | |
# | |
# Usage: | |
# $ python mailrss2opml.py > export.opml | |
# | |
import os | |
import 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
foreach ($node->taxonomy as $item) { | |
$parents = taxonomy_get_parents($item->tid); | |
$parents_used = array(); | |
foreach ($parents as $item2) { | |
if ($item2->vid == 2 && !isset($parents_used[$item2->tid])) { | |
$parents_used[$item2->tid] = true; | |
} | |
} | |
var_dump(array_keys($parents_used)); |
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 | |
# first you'll want to create a gist then `git clone` the private url | |
# second you'll want to run this script in the gist's directory | |
while [ 1 ]; do | |
git commit -a -m save && git push origin master; | |
sleep $(echo "60 * 4" | bc); | |
done; |
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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
// prototype | |
vector<int> & buy(); | |
int main () | |
{ | |
vector<int> j; |
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
<?php | |
class URLConf | |
{ | |
private $_conf = array(); | |
private $_controller; | |
private $_method; | |
private $_args; | |
private $_default_controller; |
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 | |
# | |
""" | |
$ ./transmorgify.py | |
input: http://yahoo.com www.blah.com 13 monkey's @username blah | |
output: ['monkeys', 'blah'] | |
input: Super impressive http://tr.im/lWb7 (via @jcsalterego) | |
output: ['Super', 'impressive', 'via'] | |
input: |
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
# | |
# How do I extract a parameter from a URL in plain Ruby? | |
# "http://foo.com/bar.html?a=sdfas&b=xyz Want the value of parameter a. | |
# - http://twitter.com/mperham/status/2019870182 | |
# | |
URL = "http://foo.com/bar.html?a=sdfas&b=xyz" | |
paramify = lambda url: dict([kv.split("=") | |
for kv | |
in url.split("?")[1].split("&")]) |