This file contains 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
;; | |
;; 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. |
This file contains 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
function pwdx { | |
lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $NF}' | |
} |
This file contains 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
## | |
# 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: |
This file contains 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
/* | |
____ _____ | |
/\__ \ /\ ___\ | |
\/__/\ \ \ \ \__/_ | |
\ \ \ \ \____ \ | |
_\_\ \ \/__/_\ \ | |
/\ _____\ /\ _____\ | |
\/______/ \/______/ | |
Copyright (C) 2011 Joerg Seebohn |
This file contains 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
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 |
This file contains 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
/*! 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) { |
This file contains 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
; 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 ) |
This file contains 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
# 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 |
This file contains 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
(def s (start-server 3000 inc false)) | |
;; echo 10\n20\n30 | nc localhost 3000 | |
;; => 11\n21\n31 | |
(stop-server s) |
This file contains 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
# 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) ]) |
OlderNewer