Skip to content

Instantly share code, notes, and snippets.

View scotthaleen's full-sized avatar
λ

スコット scotthaleen

λ
View GitHub Profile
;annotation syntax
(import [java.lang.annotation Retention RetentionPolicy Target ElementType]
[javax.xml.ws WebServiceRef WebServiceRefs])
(definterface Foo (foo []))
;annotation on type
(deftype ^{Deprecated true
Retention RetentionPolicy/RUNTIME
javax.annotation.processing.SupportedOptions ["foo" "bar" "baz"]
@sunilnandihalli
sunilnandihalli / curry.clj
Created December 17, 2010 20:33
a macro to create fixed-arity curryable function in clojure
(defmacro def-curry-fn [name args & body]
{:pre [(not-any? #{'&} args)]}
(if (empty? args)
`(defn ~name ~args ~@body)
(let [rec-funcs (reduce (fn [l v]
`(letfn [(helper#
([] helper#)
([x#] (let [~v x#] ~l))
([x# & rest#] (let [~v x#]
(apply (helper# x#) rest#))))]
@gorsuch
gorsuch / gist:1418850
Created December 1, 2011 18:37
clojure uuid
(defn uuid [] (str (java.util.UUID/randomUUID)))
@adrienbrault
adrienbrault / purge.sh
Created September 24, 2012 10:02
Script to reduce VM size before packaging for vagrant
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@zenorocha
zenorocha / .hyper.js
Last active November 12, 2023 15:13 — forked from millermedeiros/osx_setup.md
Setup macOS Sierra (10.12)
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
@also
also / gist:7729708
Last active June 1, 2021 09:02
how does /usr/libexec/java_home work?
# /usr/libexec/java_home -X
$ sudo opensnoop -n java_home
UID PID COMM FD PATH
501 79809 java_home 3 /System/Library/PrivateFrameworks/JavaLaunching.framework/Versions/A/JavaLaunching
501 79809 java_home 3 /dev/dtracehelper
501 79809 java_home 4 /System/Library/CoreServices/SystemVersion.bundle//English.lproj
501 79809 java_home -1 /System/Library/CoreServices/SystemVersion.bundle//Base.lproj
501 79809 java_home 4 /System/Library/CoreServices/SystemVersion.bundle/English.lproj/SystemVersion.strings
501 79809 java_home -1 /System/Library/CoreServices/SystemVersion.bundle/English.lproj/SystemVersion.stringsdict
501 79809 java_home 3 /usr/share/icu/icudt51l.dat
@evanscottgray
evanscottgray / docker_kill.sh
Last active November 7, 2023 03:40
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@addyosmani
addyosmani / README.md
Last active July 13, 2024 21:26 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@borkdude
borkdude / cljrepl.scala
Last active August 22, 2019 18:44
Clojure REPL inside Scala program
~/dev/scala/cljrepl $ cat build.sbt
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.clojure" % "clojure" % "1.8.0"
)
~/dev/scala/cljrepl $ cat src/main/scala/foo.scala
import clojure.java.api.Clojure
import clojure.java.api.Clojure.{`var` => cvar}