Skip to content

Instantly share code, notes, and snippets.

View tomisme's full-sized avatar
🌱
playing with frogs

Tom H. tomisme

🌱
playing with frogs
View GitHub Profile
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@jasongilman
jasongilman / atom_clojure_setup.md
Last active January 11, 2024 09:13
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

How Clojure's documentation can leapfrog other languages

Summary

I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.

The Problem

Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."

@joshcho
joshcho / reactive_render.cljc
Last active January 5, 2024 06:02
Delight, Generating Interactive Controls over Electric Code
;; This is free and unencumbered software released into the public domain.
;;
;; Anyone is free to copy, modify, publish, use, compile, sell, or
;; distribute this software, either in source code form or as a compiled
;; binary, for any purpose, commercial or non-commercial, and by any
;; means.
;;
;; In jurisdictions that recognize copyright laws, the author or authors
;; of this software dedicate any and all copyright interest in the
;; software to the public domain. We make this dedication for the benefit
@niallsmart
niallsmart / copy-checklist.js
Last active December 28, 2023 00:10
Copy Trello checklist to clipboard
copy($(".checklist-item:not(.checklist-item-checked)").map(function() {
var e = $(this),
item = e.find(".checklist-item-details-text").text()
if (e.hasClass("checklist-item-state-complete")) {
item = item + " (DONE)"
}
return item
}).get().join("\n"))
@jackrusher
jackrusher / webdav.clj
Last active November 1, 2023 22:07
A minimal webdav server/synthetic filesystem that works with JVM Clojure and babashka. See comments for instructions!
(ns webdav
(:require [clojure.string :as str]
[clojure.data.xml :as xml]
[org.httpkit.server :as hk-server]))
;; add the XML namespace that we'll use later
(xml/alias-uri 'd "DAV:")
(defn dissoc-in
"Should be in the standard library..."
(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)
@bhb
bhb / README.md
Last active May 15, 2023 01:28
Clojure friendly mode, inspired by https://github.com/slipset/friendly
@jackrusher
jackrusher / AAA-README.md
Created October 16, 2020 12:02
Clojure + FUSE

Meld

A minimal example of creating a (mostly) working FUSE filesystem using Clojure. NOTE: I have only tested this with OSX, and it assumes you have already installed libfuse.

Trying it out

Create an empty directory at /tmp/meld to serve as your mount point, put these files in a directory called meld, then:

@simonw
simonw / crontab.txt
Created September 10, 2020 16:09
Dogsheep crontab.txt as of 10th September 2020
# Fetch latest configuration:
*/5 * * * * cd /home/ubuntu/dogsheep-config && python3 git_pull_and_run_scripts.py . && sudo python3 ensure_symlinks.py files-to-symlink
# Goodreads
46 * * * * cd /home/ubuntu && /home/ubuntu/datasette-venv/bin/goodreads-to-sqlite books goodreads.db -a auth.json
# Twitter
1,11,21,31,41,51 * * * * /home/ubuntu/datasette-venv/bin/twitter-to-sqlite user-timeline /home/ubuntu/twitter.db -a /home/ubuntu/auth.json --since
2,7,12,17,22,27,32,37,42,47,52,57 * * * * run-one /home/ubuntu/datasette-venv/bin/twitter-to-sqlite home-timeline /home/ubuntu/timeline.db -a /home/ubuntu/auth.json --since
4,14,24,34,44,54 * * * * run-one /home/ubuntu/datasette-venv/bin/twitter-to-sqlite mentions-timeline /home/ubuntu/twitter.db -a /home/ubuntu/auth.json --since