Skip to content

Instantly share code, notes, and snippets.

Dear github,
Your "advanced search" functionality is not discoverable at ALL. I thought that was just a cute little icon, not that it did anything.
If you happen to see this please fix it.
Love always,
Leif
<?php
namespace ynd\thsx\core;
class Router {
protected $prefix;
protected $routes;
// Used in specificity calculations.
const MAX_PATH_SEGMENTS = 10;
public function __construct($routes, $prefix = NULL) {
(let [method-for-class
(fn [cls name]
(first
(filter (complement nil?)
(map (fn [m] (when (= (. m (getName)) name) m))
(. cls (getMethods))))))]
(defn setter
"turns a :key-word into a java setKeyWord function"
[cls kword]
(let [toks (re-seq #"[^-]+" (. (str kword) (substring 1)))
a = []
for line in raw.readlines():
line = line.split()
if line:
if line[-1] == "space":
a.append(' ')
elif len(line[-1]) > 1:
a.append('?')
else:
a.append(line[-1])
#include <stdio.h>
#include <stdlib.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
int main(void)
{
static char input[] = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromtheseh
;; git://github.com/jochu/clojure-mode.git
(add-to-list 'load-path (expand-file-name "~/git/clojure-mode"))
;; git://github.com/jochu/swank-clojure.git
(add-to-list 'load-path (expand-file-name "~/git/swank-clojure"))
;; git://git.boinkor.net/slime.git
(add-to-list 'load-path (expand-file-name "~/git/slime"))
(add-hook 'clojure-mode-hook 'turn-on-eldoc-mode)
(autoload 'paredit-mode "paredit"
(defn make-lines [data]
"Generates a collection of svg line elements based on the supplied data points"
(for [[idx [prev-val this-val]] (partition 2 (interleave (range) (partition 2 1 data)))]
(make-line idx prev-val (inc idx) this-val)))
@leifwalsh
leifwalsh / gist:1013465
Created June 7, 2011 23:41
dirty rotten password manager
$ cat >~/bin/mypass
#!/bin/bash
if [[ $# -ne 1 ]]; then echo "Usage: $(basename $0) <site>" && exit 2; fi
(gpg -q -d ~/.passwd.gpg; echo "$1") | sha256sum | cut -c-16
^D
$ gpg --default-recipient-self -e >~/.passwd.gpg
<your password here>^D^D
@leifwalsh
leifwalsh / gist:4324080
Created December 18, 2012 01:13
error building mariadb-5.5.28a with CC=cc CXX=c++ on osx
Linking C executable async_example
Undefined symbols for architecture x86_64:
"std::terminate()", referenced from:
yaSSL::read_file(yaSSL::SSL_CTX*, char const*, int, yaSSL::CertType) in libmysqlclient.a(ssl.cpp.o)
_yaEVP_BytesToKey in libmysqlclient.a(ssl.cpp.o)
_yaSSLv3_client_method in libmysqlclient.a(ssl.cpp.o)
_yaSSLv3_server_method in libmysqlclient.a(ssl.cpp.o)
_yaTLSv1_server_method in libmysqlclient.a(ssl.cpp.o)
_yaTLSv1_client_method in libmysqlclient.a(ssl.cpp.o)
_yaTLSv1_1_server_method in libmysqlclient.a(ssl.cpp.o)