Skip to content

Instantly share code, notes, and snippets.

@zamaterian
zamaterian / bashrc
Created December 13, 2011 13:08
Clojure highlightning for cli less via source-hightlight
# add to .bashrc or .profile
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@Chouser
Chouser / externs_for_cljs.clj
Created June 17, 2013 13:44
Generate an externs.js file for arbitrary JS libraries for use in advanced Google Closure compilation, based on the ClojureScript code that uses the libraries.
(ns n01se.externs-for-cljs
(:require [clojure.java.io :as io]
[cljs.compiler :as comp]
[cljs.analyzer :as ana]))
(defn read-file [file]
(let [eof (Object.)]
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))]
(vec (take-while #(not= % eof)
(repeatedly #(read stream false eof)))))))
@jmervine
jmervine / 01_nginx.conf
Last active November 27, 2021 16:04
Nginx Based A/B testing.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /home/t/nginx/conf/mime.types;
default_type application/octet-stream;
@kujohn
kujohn / portforwarding.md
Last active April 27, 2024 20:16
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

anonymous
anonymous / gist:8462610
Created January 16, 2014 20:15
;; monad
(defprotocol IBindable
(mbind [mv func]))
;; error monad
(defprotocol Error
(from-just [this])
(get-error-text [this])
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@doorhammer
doorhammer / stringSimilarity.js
Created April 3, 2014 16:32
Algorithm using the Sørensen–Dice coefficient to compare the similarity of two strings
var sSimilarity = function(sa1, sa2){
// Compare two strings to see how similar they are.
// Answer is returned as a value from 0 - 1
// 1 indicates a perfect similarity (100%) while 0 indicates no similarity (0%)
// Algorithm is set up to closely mimic the mathematical formula from
// the article describing the algorithm, for clarity.
// Algorithm source site: http://www.catalysoft.com/articles/StrikeAMatch.html
// (Most specifically the slightly cryptic variable names were written as such
// to mirror the mathematical implementation on the source site)
//
@allgress
allgress / reagent_datascript.cljs
Last active February 16, 2023 21:16
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))