Skip to content

Instantly share code, notes, and snippets.

@gus
gus / index.txt
Created November 30, 2009 21:55 — forked from toothrot/index.txt
Ruby/Clojure analogs
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:
@mayoff
mayoff / gist:1138816
Last active December 8, 2023 22:00
AppleScript to make Google Chrome open/reload a URL
(* To the extent possible under law, Rob Mayoff has waived all copyright and related or neighboring rights to “AppleScript to make Google Chrome open/reload a URL”. This work is published from: United States. https://creativecommons.org/publicdomain/zero/1.0/ *)
tell application "Google Chrome"
activate
set theUrl to "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
if (count every window) = 0 then
make new window
end if
set found to false
@allieus
allieus / gist:1180051
Last active June 25, 2022 18:10
wgs84/tm127/tm128/grs80/cyworld 간 좌표변환
'''
aero님께서 구현하신 구글/네이버/싸이월드/콩나물 좌표변환은 펄/자바스크립트로 되어있습니다.
펄/자바스크립트에 익숙지 않은지라, 수식을 파이썬으로 번역해보았습니다.
'''
from pyproj import Proj
from pyproj import transform
WGS84 = { 'proj':'latlong', 'datum':'WGS84', 'ellps':'WGS84', }
(ns hbase.cascalog.core
(:require [cascalog.workflow :as w])
(:import [cascading.hbase HBaseTap HBaseScheme ByteHolder]
[cascading.tuple Fields]
org.apache.hadoop.hbase.util.Bytes))
(defn hbase-tap [table-name key-field column-family & value-fields]
(let [scheme (HBaseScheme. (w/fields key-field) column-family (w/fields value-fields))]
(HBaseTap. table-name scheme)))
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@stuarthalloway
stuarthalloway / gist:2645453
Created May 9, 2012 15:22
Datomic queries against Clojure collections
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
@martintrojer
martintrojer / queries.clj
Created July 16, 2012 12:16
Datomic queries in core.logic
(ns queries
(:refer-clojure :exclude [==])
(:use [clojure.core.logic])
(:use [datomic.api :only [q]]))
(defn query [rule xs]
(let [prule (prep rule)]
(map #(binding-map* prule (prep %)) xs)))
;; ---
@jcromartie
jcromartie / arcc.clj
Created October 31, 2012 14:57
arc challenge in Clojure
(ns arc.core
(:use compojure.core)
(:require [compojure.route :as route]
[compojure.handler :as handler]
[ring.util.response :as response]
[ring.adapter.jetty :as jetty]))
(def route-map (ref {}))
(def ^:dynamic *params* nil)
@sorenmacbeth
sorenmacbeth / ambrose.clj
Last active August 29, 2015 13:55
cascalog ambrose integration
(defn ambrose?-
[& bindings]
(let [[name bindings] (flow/parse-exec-args bindings)
bindings (mapcat (partial apply normalize-sink-connection)
(partition 2 bindings))
flow (-> (apply compile-flow name bindings)
flow/flow-def
flow/compile-hadoop)
server (EmbeddedAmbroseCascadingNotifier.)]
(.addListener flow server)
@gdevanla
gdevanla / y-combinator-clojure.clj
Last active October 9, 2022 16:46
Y-Combinator in Clojure based on Jim Weirich's talk Y-NOT
;; This gist roughly transribes the demo
;; by Jim Weirich during his talk on Y-Combinator
;; called Y-Not.
;; http://www.infoq.com/presentations/Y-Combinator
;; Jim does a phenomenal job of explaining in the demo.
;; Therefore, this gist only attempts to provide
;; the code example from the poor quality video
;; The examples are simplified at some places
;; based on how I tried to understand it