Skip to content

Instantly share code, notes, and snippets.

@zerokarmaleft
zerokarmaleft / aws-application.rb
Created April 21, 2011 19:51
Retrieving album cover art from AWS with MacRuby and Sucker
framework 'Cocoa'
require 'rubygems'
require 'sucker'
application = NSApplication.sharedApplication
worker = Sucker.new(
:locale => :us,
:key => aws_key,
@zerokarmaleft
zerokarmaleft / clj_lab.rb
Created September 26, 2011 18:07
accessing clojure's PersistentHashMap from jruby
require 'java'
require 'clojure'
module Clojure
include_package 'clojure.lang'
end
foo = Clojure::PersistentHashMap.create(:a, 1)
# => {:a=>1}
foo.assoc(:e, 5)
@zerokarmaleft
zerokarmaleft / stress-ref.clj
Created September 29, 2011 20:45
SLIME doesn't display the println
(defn stress-ref
[r]
(let [slow-tries (atom 0)]
(future
(dosync
(swap! slow-tries inc)
(Thread/sleep 200)
@r)
(println (format "r is: %s, history: %d, after: %d tries"
@r (ref-history-count r) @slow-tries)))
@zerokarmaleft
zerokarmaleft / gist:1338369
Created November 4, 2011 00:35
sm --trace cli dev setup core setup
+/Users/zerokarmaleft/.sm/core/cli/shell/dev/functions:69 sm_development_setup():66 > git clone https://github.com/sm/sm-extensions extensions
Cloning into extensions...
fatal: https://github.com/sm/sm-extensions/info/refs not found: did you run git update-server-info on the server?
+/Users/zerokarmaleft/.sm/core/cli/shell/dev/functions:70 sm_development_setup():67 > __sm.log.error 'There was an __sm.log.error cloning extensions repository from https://github.com/sm/sm-extensions into /Users/zerokarmaleft/projects/sm/extensions.'
+/Users/zerokarmaleft/.sm/core/sm/shell/log/functions:343 __sm.log.error():2 > printf 'ERROR(__sm.actions.call): There was an __sm.log.error cloning extensions repository from https://github.com/sm/sm-extensions into /Users/zerokarmaleft/projects/sm/extensions.\n'
ERROR(__sm.actions.call): There was an __sm.log.error cloning extensions repository from https://github.com/sm/sm-extensions into /Users/zerokarmaleft/projects/sm/extensions.
+/Users/zerokarmaleft/.sm/core/sm/shell/log/func
@zerokarmaleft
zerokarmaleft / gist:1410689
Created November 30, 2011 20:31 — forked from buddylindsey/gist:1410596
Max-Heap
#include <iostream>
#include <stdlib.h>
#include <limits.h>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
ofstream outfile;
Downloading/unpacking git+https://github.com/matplotlib/matplotlib.git
Cloning https://github.com/matplotlib/matplotlib.git to /var/folders/4w/561vz2190dn77blh513pjzv40000gn/T/pip-U1irSG-build
Running setup.py egg_info for package from git+https://github.com/matplotlib/matplotlib.git
basedirlist is: []
============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.2.x
python: 2.7.2 (default, Jan 4 2012, 15:48:19) [GCC 4.2.1
(Based on Apple Inc. build 5658) (LLVM build
2336.1.00)]
@zerokarmaleft
zerokarmaleft / gist:2378363
Created April 13, 2012 17:00
git log --author="Edward Cho" --pretty=oneline --abbrev-commit
902334d Merge branch 'master' of http://github.com/mxcl/homebrew
37fd330 Merge branch 'master' of http://github.com/mxcl/homebrew
975d89d Merge branch 'master' of http://github.com/mxcl/homebrew
7beb002 Merge branch 'master' of http://github.com/mxcl/homebrew
232288d Merge branch 'master' of http://github.com/mxcl/homebrew
a9504f5 Merge branch 'master' of http://github.com/mxcl/homebrew
310754e Merge branch 'master' of http://github.com/mxcl/homebrew
d0286ef Merge branch 'master' of http://github.com/mxcl/homebrew
8358887 Merge branch 'master' of http://github.com/mxcl/homebrew
ec977fd Merge branch 'master' of http://github.com/mxcl/homebrew
@zerokarmaleft
zerokarmaleft / *swank*
Created June 16, 2012 04:17
bootstrapping swank
;;; Bootstrapping bundled version of SLIME; please wait...
(sleep-for 0.1)
(run-hooks 'slime-load-hook) ; on port 64738
;;; Done bootstrapping.
The eval-in-project function has moved to the leiningen.core.eval
namespace; please update your plugin to use that instead.
Note that `init' is now the third argument instead of the fifth.
@zerokarmaleft
zerokarmaleft / foo.js
Created July 4, 2012 02:48
defining node.js modules
(function() {
var Foo;
Foo = (function() {
function Foo() {
// initialize properties
}
// instance methods
Foo.prototype.bar = function() {};
@zerokarmaleft
zerokarmaleft / init.el
Created July 19, 2012 14:03
adding melpa repository
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)