Skip to content

Instantly share code, notes, and snippets.

View f-f's full-sized avatar
🍝
All undocumented software will be reverse-engineered and rewritten

Fabrizio Ferrai f-f

🍝
All undocumented software will be reverse-engineered and rewritten
View GitHub Profile
@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

@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 09:54
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@vikeri
vikeri / debug-re-frame-subs.clj
Last active September 3, 2016 15:35
re-frame debug sub macro
;; A macro that replaces reg-sub, it inserts debug print statements into reg-sub if a flag of choice is set
;; Developed since 0.8.0 does not work with re-frame-tracer
;; Use it by replacing re-frame.core/reg-sub with this macro
(defmacro reg-sub [label & sub]
(let [fun (last sub)
arg (get-in (vec fun) [1 1 1])
[before after] (split-at 2 fun)
new-fun (concat before [`(js/console.log "Sub: " [~label ~arg])] after)]
(if (= "true" env/PRODUCTION) ;; Or whatever way you want to disable this, may also be done by replacing js/console.log above
@pesterhazy
pesterhazy / react-native-only.py
Created August 5, 2016 13:55
Filter "react-native log-ios" output for relevant app logs
#!/usr/bin/env python
# Cleans up the output of "react-native log-ios" by
# removing all output not related to your app, similarly
# to how it works in the XCode debug window
#
# Usage: react-native log-ios | ./react-native-only.py "<string>"
#
# where "<string>" is the name of your app as known
# to the iOS logging system. E.g. "SimpleExampleApp"
@bhauman
bhauman / compiler-options-schema.clj
Last active August 8, 2017 21:19
A Schema for ClojureScript Options
(ns cljs.compiler-options-schema
(:require
[clojure.spec :as s]
[clojure.string :as string]
;; for initial dev
[clojure.test :refer [deftest is testing]]))
(defn non-blank-string? [x] (and (string? x) (not (string/blank? x))))
(defonce ^:private registry-ref (atom {}))
@m-ou-se
m-ou-se / replace-debian-with-arch.txt
Last active October 22, 2023 12:16
Instructions to replace a live Debian installation with Arch
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/
wget 'ftp://ftp.nluug.nl/pub/os/Linux/distr/archlinux/iso/latest/archlinux-bootstrap-*-x86_64.tar.gz'
# Make sure you'll have enough entropy for pacman-key later.
apt-get install haveged
# Install the arch bootstrap image in a tmpfs.
mount -t tmpfs none /mnt
cd /mnt
tar xvf ~/archlinux-bootstrap-*-x86_64.tar.gz --strip-components=1
@mnot
mnot / snowden-ietf93.md
Last active September 12, 2023 13:40
Transcript of Edward Snowden's comments at IETF93.
@mbutz
mbutz / gist:8bf1a47a608a368272f2
Last active November 2, 2017 19:24
Sonic Pi Sequencer - Beta 2
# Sonic Pi Sequencer (v2)
# Simplified notation of synth lines, can now play chords
use_debug false
set_volume! 1
use_bpm 120 # beat = quarter note
# TODO
# Make 'play_rhythm_bar' to work with an array of samples like 'play_melody_bar'
@dustingetz
dustingetz / gist:71fe73f8599b13c9e59e
Last active October 4, 2016 12:11
hypercrud livecoding demo
;; Datomic uses immutability to make read queries come from in-app process instead of network.
;; Web service backed by datomic can have same performance characteristics - browser ajax read
;; queries can come from in-browser. Changes browser programming model - can code as if all data
;; is local. Removes all read-IO from browser apps. Components that do IO can now compose.
;; Still ACID & relational queries like datomic.
;;
;; Other solutions to same problem: Facebook Relay/GraphQL, Netflix Falcor, Om Next
@martin-hewitt
martin-hewitt / gist:2e022bba0775c8ac1e39
Created January 20, 2015 10:55
Docker Stack - Ghost, piwik & ownCloud under SSL'd nginx
# Get a server, somehow. Mine runs CentOS 7
# All commands to be run as root, so either sudo su, or add sudo to each one
# Install Docker
yum install docker
# This nginx proxy listens to the main Docker socket for containers starting
# and stopping. It then reads the VIRTUAL_HOST environment variable for that
# container and creates a proxy route for each one. Containers without a
# VIRTUAL_HOST environment variable will be ignored. This fork also allows