Skip to content

Instantly share code, notes, and snippets.

Michał Marczyk michalmarczyk

View GitHub Profile
@fogus
fogus / emagic.clj
Created Jan 7, 2011
how to make your own forms indent properly in emacs with clojure-mode
View emagic.clj
(defn pumpkin [op & args]
(apply op args))
(pumpkin +
1
2
3)
;; in emacs do:
;; M-x eval-expression
View callbacksarehard.js
// before
mainWindow.menu("File", function(err, file) {
if(err) throw err;
file.openMenu(function(err, menu) {
if(err) throw err;
menu.item("Open", function(err, item) {
if(err) throw err;
item.click(function(err) {
if(err) throw err;
mainWindow.getChild(type('Window'), function(err, dialog) {
@pepijndevos
pepijndevos / test.clj
Created Apr 21, 2011
Alternative implementation of clojure.core/seque
View test.clj
(ns test
(:import [java.util.concurrent
BlockingQueue
LinkedBlockingQueue
SynchronousQueue
PriorityBlockingQueue
CyclicBarrier])
(:use clojure.test)
(:refer-clojure :exclude [seque]))
@hugoduncan
hugoduncan / gist:1033762
Created Jun 19, 2011
Use aether for artifact resolving
View gist:1033762
(ns pallet.aether
"Wrapper for aether resolution
See:
https://docs.sonatype.org/display/AETHER/Home"
(:require
[clojure.java.io :as io]
[clojure.contrib.logging :as logging])
(import
org.apache.maven.repository.internal.MavenRepositorySystemSession
@stuartsierra
stuartsierra / gist:1188879
Created Sep 2, 2011
XML parsing and clojure.zip
View gist:1188879
;;; XML parsing and clojure.zip
;;; There's got to be a cleaner way to do this.
;;; I have code like this:
(defn jdks-loc [xml-zipper]
(zip/down
(first
(filter #(let [n (zip/node %)]
View gist:1209498
(ns trace
(:use clojure.pprint))
(declare trace-form)
(def *ignore*
'#{def quote var try monitor-enter monitor-exit})
(defmulti trace-special-form (fn [form] (first form)))
@nathanmarz
nathanmarz / gist:1228302
Created Sep 20, 2011
Example of defining a topology in Clojure
View gist:1228302
(use 'backtype.storm.clojure)
(use 'backtype.storm.config)
(require '[backtype.storm [thrift :as thrift]])
(import 'storm.starter.spout.RandomSentenceSpout)
(import 'backtype.storm.LocalCluster)
(defboltfull suffix-bolt ["word"]
:params [suffix]
:let [conf-state (atom nil)]
:prepare ([conf context collector]
View iuny.lisp
;;; -*- Package: User; Syntax: Common-Lisp; Mode: Lisp; Base: 10 -*-
;;; unify.lisp
(in-package "USER")
;;; ****************************************************************
;;; Unification Algorithm ******************************************
;;; ****************************************************************
;;;
;;; Random implementations of unification.
View select-match.lisp
;;
;; SELECT-MATCH macro (and IN macro)
;;
;; Copyright 1990 Stephen Adams
;;
;; You are free to copy, distribute and make derivative works of this
;; source provided that this copyright notice is displayed near the
;; beginning of the file. No liability is accepted for the
;; correctness or performance of the code. If you modify the code
;; please indicate this fact both at the place of modification and in
@cemerick
cemerick / gist:1452640
Created Dec 9, 2011
dependency-tree for Leiningen
View gist:1452640
;; requires [com.cemerick/pomegranate "0.0.2"]
;; i.e. https://github.com/cemerick/pomegranate
(use '[cemerick.pomegranate.aether :only (dependency-hierarchy resolve-dependencies)])
=> (pprint
(dependency-hierarchy
'[[incanter "1.2.3"]]
(resolve-dependencies {:coordinates '[[incanter "1.2.3"]]
:repositories (merge cemerick.pomegranate.aether/maven-central {"clojars" "http://clojars.org/repo"})})))
You can’t perform that action at this time.