Skip to content

Instantly share code, notes, and snippets.

View ku1ik's full-sized avatar
👋

Marcin Kulik ku1ik

👋
View GitHub Profile
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@mojombo
mojombo / vwilight.vim
Created January 26, 2011 03:23
vwilight.vim: A TRUE Twilight color theme for Vim
" Vim color file
" Converted from Textmate theme Twilight using Coloration v0.2.5 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@alexyoung
alexyoung / deploy.sh
Created May 17, 2011 10:47
Deployment script
#!/usr/bin/env bash
# Configuration
SERVER='myserver'
DEPLOY_TO='/path/to/app'
EXCLUDE='*.swp .git/ db/sphinx/ tmp/ log/'
DRY_RUN=false
DEPLOY_GEM_PATH='/opt/ec/ruby/1.8.7/lib/ruby/gems/1.8'
@zumbojo
zumbojo / bijective.rb
Created July 9, 2011 22:09
Simple bijective function (base(n) encode/decode)
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join
@cehoffman
cehoffman / colorize.c
Created August 7, 2011 00:04
ZSH STDERR Colorizing
/* $Id: colorize.c 3816 2004-07-03 17:01:32Z lefevre $
*
* Colorize the standard input. Written for zsh stderr coloring.
* This was taken from a mail archive on the subject of colorizing
* the stderr stream in zsh. It was written by Vincent Lefèvre as far
* as I know. It is here so it can be used in a brew formula.
*
* The intended usage is to place a line like the following in your zshrc
* exec 2>>(colorize `tput bold; tput setaf 1` `tput sgr0` > /dev/tty &)
*
@ajashton
ajashton / gist:1258443
Created October 3, 2011 04:31
Edit of GNOME 3's Adwaita Metacity theme to remove the titlebar when the window is maximized.
diff --git a/metacity-1/metacity-theme-3.xml b/metacity-1/metacity-theme-3.xml
index 0e285a9..52d8c54 100644
--- a/metacity-1/metacity-theme-3.xml
+++ b/metacity-1/metacity-theme-3.xml
@@ -46,17 +46,14 @@
<distance name="right_titlebar_edge" value="1"/>
</frame_geometry>
-<frame_geometry name="max" title_scale="medium" parent="normal" rounded_top_left="false" rounded_top_right="false">
+<frame_geometry name="max" has_title="false" parent="normal" rounded_top_left="false" rounded_top_right="false">
@tolitius
tolitius / bootcamp.factorial.clj
Created February 2, 2012 04:36
clojure bootcamp: loop/recur vs. reduce vs. recursion
(ns bootcamp.factorial)
(defn fast-factorial [number]
(loop [n number factorial 1]
(if (zero? n)
factorial
(recur (- n 1) (* factorial n)))))
(defn fast-no-loop-factorial
([number] (fast-no-loop-factorial number 1))
@zmalltalker
zmalltalker / gist:1891397
Created February 23, 2012 07:53
Very simple upstart script for Unicorn
chdir /var/www/rails_apps/the_one
env RAILS_ENV=production
exec /usr/bin/bundle exec unicorn_rails -c config/unicorn.rb
respawn
# This start on stanza works, but it's simplistic
# Will add a stop on stanza once I make up my mind about stop on
start on runlevel [3]
@postmodern
postmodern / Makefile
Last active March 4, 2024 14:42
A generic Makefile for building/signing/install bash scripts
NAME=project
VERSION=0.0.1
DIRS=etc lib bin sbin share
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null`
DOC_FILES=*.md *.txt
PKG_DIR=pkg
PKG_NAME=$(NAME)-$(VERSION)