Skip to content

Instantly share code, notes, and snippets.

View jolby's full-sized avatar

Joel Boehland jolby

View GitHub Profile
@ghoseb
ghoseb / ns-cheatsheet.clj
Last active April 11, 2024 05:28 — forked from alandipert/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
@tobym
tobym / pwdx_for_mac.bash
Created October 27, 2010 01:03
pwdx for mac. Usage: pwx pid
function pwdx {
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}'
}
@dawsontoth
dawsontoth / t.sh
Created March 4, 2011 19:37
Bash script to quickly simulate / emulate / deploy Appcelerator Titanium Mobile apps
##
# This script helps you run Titanium Mobile apps from the command line.
#
# You will want to customize the variables on lines 25-37, per your own environment.
# Most important is to customize "appRootDirectory".
#
# It can be used a couple of different ways:
# 1) To start the Android emulator:
# ./t a
# 2) To start a simulator, emulator, or deploy to device, use the following:
@je-so
je-so / testprogram.c
Last active January 13, 2024 22:27
Xlib transparent window with OpenGL support
/*
____ _____
/\__ \ /\ ___\
\/__/\ \ \ \ \__/_
\ \ \ \ \____ \
_\_\ \ \/__/_\ \
/\ _____\ /\ _____\
\/______/ \/______/
Copyright (C) 2011 Joerg Seebohn
from django.views.generic.base import View, TemplateResponseMixin
from django.views.generic.edit import FormMixin, ProcessFormView
class MultipleFormsMixin(FormMixin):
"""
A mixin that provides a way to show and handle several forms in a
request.
"""
form_classes = {} # set the form classes as a mapping
/*! hsv_to_hsl.scss | MIT License | https://gist.github.com/voxpelli/1069204 */
@function max($v1, $v2) {
@return if($v1 > $v2, $v1, $v2);
}
@function min($v1, $v2) {
@return if($v1 < $v2, $v1, $v2);
}
@function hsv_to_hsl($h, $s: 0, $v: 0) {
@zliuva
zliuva / gist:1084476
Last active July 31, 2023 21:32
A minimal Mach-o x64 executable for OS X
; A minimal Mach-o x64 executable for OS X (also see below Mountain Lion version)
;
; $ nasm -f bin -o tiny_hello tiny_hello.s
; $ chmod +x tiny_hello
; $ ./tiny_hello
; Hello World!
; $
; c.f.
; http://osxbook.com/blog/2009/03/15/crafting-a-tiny-mach-o-executable/ ( the original tiny mach-o executable )
@sstephenson
sstephenson / gist:1120938
Created August 2, 2011 19:08
Quick guide to installing rbenv
# Clone rbenv into ~/.rbenv
git clone git@github.com:sstephenson/rbenv.git ~/.rbenv
# Add rbenv to your PATH
# NOTE: rbenv is *NOT* compatible with rvm, so you'll need to
# remove rvm from your profile if it's present. (This is because
# rvm overrides the `gem` command.)
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.bash_profile
exec $SHELL
@ordnungswidrig
ordnungswidrig / example.clj
Created August 5, 2011 13:03
Simple clojure rpc server using read and pr to serialize messages
(def s (start-server 3000 inc false))
;; echo 10\n20\n30 | nc localhost 3000
;; => 11\n21\n31
(stop-server s)
@iloveitaly
iloveitaly / base_name.py
Created August 19, 2011 17:09
Normalizing Addresses With Google Refine + Maps
# eliminate stop words and create base name from title
import re
import urllib2
stop_words = urllib2.urlopen("http://www.textfixer.com/resources/common-english-words.txt").read().split(",") + ["cds", "mp", "cd", "dvd"]
words = re.sub(r"[^a-zA-Z]", ' ', value).lower().split(" ")
existing = set()
return "_".join([i for i in words if len(i) > 1 and not i in stop_words and i != "" and not i in existing and not existing.add(i) and (len(existing) < 5 or len("_".join(existing)) < 35) ])