Skip to content

Instantly share code, notes, and snippets.

View number23's full-sized avatar
🎯
Focusing

number23 number23

🎯
Focusing
View GitHub Profile
@hozumi
hozumi / meisuu.clj
Created December 13, 2010 06:23 — forked from kencoba/meisuu.clj
(use 'clojure.contrib.str-utils)
(def digits {"零" 0 "一" 1 "二" 2 "三" 3 "四" 4 "五" 5 "六" 6 "七" 7 "八" 8 "九" 9})
(defn- str-first [s]
(str (.charAt s 0)))
(defn- trans-ichi [s]
(let [n (re-find #"[一二三四五六七八九]$" s)]
(if (nil? n) 0 (digits n))))
@number23
number23 / clojure.sh
Created December 29, 2010 04:17
clojure
#!/bin/sh
export CLOJURE_EXT=$HOME/.clojure
export CLOJURE_OPTS="-Xmx1g -server"
LIBS=$(ls -1 $CLOJURE_EXT/* 2> /dev/null)
export CLASSPATH=.:$CLOJURE_EXT:$CLASSPATH:"$(echo "$LIBS" | tr \\n :)"
JAVA=${CLOJURE_JAVA:-java}
OPTS=${CLOJURE_OPTS:-}
@prasincs
prasincs / sha1-hash.clj
Created February 15, 2011 08:36
clojure sha1 hash
(defn get-hash [type data]
(.digest (java.security.MessageDigest/getInstance type) (.getBytes data) ))
(defn sha1-hash [data]
(get-hash "sha1" data))
(defn get-hash-str [data-bytes]
(apply str
(map
#(.substring
@billdawson
billdawson / Felixge_Faves.md
Created April 7, 2011 10:49
Felix Geisendörfer's favorite utils, from his tweet storm of 07 April 2011

Felix Geisendörfer's (@felixge) faves, and what he said about them in his tweets of 07 April 2011:

I really wonder how I was able to use Terminal app all this time. iTerm2 is so much better, it hurts. (#)

If you find yourself arranging windows with your mouse on osx,

@mattpodwysocki
mattpodwysocki / jsconf2011-talks.txt
Created May 5, 2011 18:30
JSConf talks and resources
Track A
Bytes and Blobs – David Flanagan @__DavidFlanagan
Slides: http://davidflanagan.com/Talks/jsconf11/BytesAndBlobs.html
Conference Wifi Redux - Malte Ubi @cramforce
Sashimi: https://github.com/cramforce/Sashimi
Slides: http://social-traffic.streamie.org/preso/static/#slide1
Run Your JS everywhere with Jellyfish – Adam Christian @admc
@chrismatthieu
chrismatthieu / gist:992261
Created May 25, 2011 23:57
If you ever need to remove files from your GitHub repo's history, here's how to do it:
1. add all of the files you want to hide to .gitignore
2. git commit -a -m "removed files"
3. git filter-branch
4. git push origin master -f
anonymous
anonymous / bootstrap.sh
Created June 2, 2011 17:19
Django on Heroku with Celery and Sentry
virtualenv --no-site-packages .
source bin/activate
bin/pip install Django psycopg2 django-sentry
bin/pip freeze > requirements.txt
bin/django-admin.py startproject mysite
cat >.gitignore <<EOF
bin/
include/
lib/
EOF
@number23
number23 / gist:1028616
Created June 16, 2011 03:25
convert to integer
function toInt(number) {
return number && + number | 0 || 0;
}
console.log(toInt("1")); // 1
console.log(toInt("1.2")); // 1
console.log(toInt("-1.2")); // -1
console.log(toInt(1.2)); // 1
console.log(toInt(0)); // 0
console.log(toInt("0")); // 0
@number23
number23 / gist:1139091
Created August 11, 2011 07:33
sbclrc
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
;;; Check for --no-linedit command-line option.
(if (member "--no-linedit" sb-ext:*posix-argv* :test 'equal)
(setf sb-ext:*posix-argv*
@alexander-yakushev
alexander-yakushev / tetris.clj
Created September 10, 2011 00:28
Tetris implementation in Clojure
(ns tetris.core
(:import (java.awt Color Dimension BorderLayout)
(javax.swing JPanel JFrame JOptionPane JButton JLabel)
(java.awt.event KeyListener))
(:use clojure.contrib.import-static deflayout.core
clojure.contrib.swing-utils)
(:gen-class))
(import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_DOWN VK_UP VK_SPACE)