Skip to content

Instantly share code, notes, and snippets.

@lilactown
lilactown / rebel.sh
Last active June 18, 2019 09:52
Start a Clojure(Script) REPL with rebel-readline and any other dependencies you want to include
# Add these to your .bash_profile / .zshrc / etc.
# Starts a Clojure repl
function rebel-clj() {
clojure -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.4\"} $@}}" -m rebel-readline.main
}
# Starts a browser REPL
function rebel-cljs() {
clojure -Sdeps "{:deps {com.bhauman/figwheel-main {:mvn/version \"0.1.7\"} com.bhauman/rebel-readline-cljs {:mvn/version \"0.1.4\"} $@}}" -m figwheel.main
@reborg
reborg / rich-already-answered-that.md
Last active May 5, 2024 04:45
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@Deraen
Deraen / edn.cljx
Last active August 6, 2023 06:51
Transit / edn date/datetime serialisers
(ns metosin.common.edn
#+clj
(:require [clj-time.format :as f])
#+cljs
(:require [cljs-time.format :as f]
cljs.reader)
#+clj (:import [org.joda.time DateTime LocalDate]))
;;
;; #DateTime tagging
@bsima
bsima / boot-project.clj
Last active August 29, 2015 14:10
Sometimes you want to use boot as a scripting platform on top of Leinengen. Paste this code at the top of your build.boot file. It reads in the project.clj file and stores it as a map named "project" which you can then use with `set-env!` to setup your environment.
(set-env! :dependencies '[[leiningen-core "2.5.0"]])
(use 'leiningen.core.project)
(eval (read-string (slurp "project.clj")))
(set-env!
:source-paths (:source-paths project)
:resource-paths (:resource-paths project)
:dependencies (:dependencies project))
@jewelsea
jewelsea / WebViewFormPost.java
Created September 27, 2013 00:09
Performing an automated form post of login credentials using a JavaFX WebView.
import javafx.application.Application;
import javafx.beans.property.*;
import javafx.beans.value.*;
import javafx.event.*;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.web.*;
import javafx.stage.Stage;
import org.w3c.dom.*;
anonymous
anonymous / gist:3931398
Created October 22, 2012 12:59
from twisted.trial.unittest import TestCase
from twisted.internet.defer import Deferred
from twisted.internet import reactor
class TestWhyDoesThisWork(TestCase):
def test_return_deferred_pass(self):
d = Deferred()
d.addCallback(self.assertEqual, 10)
reactor.callLater(0.1, d.callback, 10)
@agleyzer
agleyzer / gist:3859749
Created October 9, 2012 16:04
Download infoq video
#!/usr/bin/env python
# Looking for MP4 videos in infoq content.
#
# <div style="width: 320px; height: 265px; float: left; margin-right: 10px;">
# <video poster="/styles/i/logo_scrubber.png" id="video" controls="controls" width="320" height="265">
# <source src="http://d1snlc0orfrhj.cloudfront.net/presentations/12-mar-lockfreealgorithms.mp4" />
# </video>
# </div>
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@flub
flub / greenlet_issue14_test.py
Created June 21, 2012 09:10
Demo script which makes greenlet raise SystemError
import random
import sys
import threading
import time
import dpkt
import eventlet
import eventlet.xthread
from eventlet.green import socket
@schmir
schmir / setup-gevent-dotgit
Created February 12, 2012 13:51
helper script for gevent git repository
#! /bin/sh
# helper script for gevent .git repository
# setup private ignore file and a custom script to build a versioned sdist
test -e gevent/__init__.py -a -e .git || exit "run this inside the gevent git repository"
cat >.git/make-sdist <<'EOF'
#! /bin/sh -e
test -e gevent/__init__.py -a -e .git || exit "run this inside the gevent git repository"