Skip to content

Instantly share code, notes, and snippets.

View madis's full-sized avatar
🧑‍💻
code mode

Madis Nõmme madis

🧑‍💻
code mode
View GitHub Profile

Why Flutter needs Clojure

”If you like Java, program in Java. If you like C#, program in C#. If you like Ruby, Swift, Dart, Elixir, Elm, C++, Python, or even C; by all means use those languages. But whatever you do, learn Clojure, and learn it well.” --- Uncle Bob (and several more tweets: 1, 2, 3).

There are lots of articles about Clojure. In this one, I'd like to share my thoughts on the advantages of using it for cross-platform mobile development. Dart programmers are the target audience, but anyone interested in Flutter and/or Clojure is welcome.

A short history of Clojure

Clojure was not created in a hurry (JS), it didn't try to seize the market with a multimillion budget (Java). It wasn't backed by a powerful company (Go, Dart,

@thiagokokada
thiagokokada / test_runner.clj
Last active November 14, 2023 15:02
Babashka's test runner that dynamically discover the tests
#!/usr/bin/env bb
;; Inspired from https://book.babashka.org/#_running_tests
(require '[clojure.test :as t]
'[clojure.string :as string]
'[babashka.classpath :as cp]
'[babashka.fs :as fs])
(cp/add-classpath "src:test")
@jamieparfet
jamieparfet / macOS-mojave-iso.sh
Last active February 11, 2023 19:16
Create an ISO from the mojave installer app
#!/bin/bash
# This assumes that the ~6GB mojave installer is in the /Applications folder.
# If it's not, just open the App Store, search Mojave, and you can download the installer file from there.
hdiutil create -o /tmp/mojave.cdr -size 6g -layout SPUD -fs HFS+J
hdiutil attach /tmp/mojave.cdr.dmg -noverify -mountpoint /Volumes/install_mojave
sudo /Applications/Install\ macOS\ mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/install_mojave
mv /tmp/mojave.cdr.dmg ~/Desktop/InstallSystem.dmg
hdiutil detach /Volumes/Install\ macOS\ mojave
@tuzz
tuzz / state-transitions.rs
Created August 6, 2018 19:10
A Rust proof-of-concept from the August 2018 Rust meeting in London.
/* This is a proof-of-concept, inspired by clojure, that stores just the
* transitions between multiple Foo structs, rather than copying the entire
* struct's fields each time.
*/
#[derive(Default)] // <-- this derives Foo::default() which creates a Foo struct
// with a and b initialized to zero.
struct Foo {
a: u8,
b: u8,
@acamino
acamino / README.md
Last active April 21, 2024 20:58
Shortcuts to Improve Your Bash & Zsh Productivity

Shortcut — Action

  • CTRL + A — Move to the beginning of the line
  • CTRL + E — Move to the end of the line
  • CTRL + [left arrow] — Move one word backward (on some systems this is ALT + B)
  • CTRL + [right arrow] — Move one word forward (on some systems this is ALT + F)
  • CTRL + U — (bash) Clear the characters on the line before the current cursor position
  • CTRL + U —(zsh) If you're using the zsh, this will clear the entire line
  • CTRL + K — Clear the characters on the line after the current cursor position
  • ESC + [backspace] — Delete the word in front of the cursor
Useful keys
These are the keys I use most times I run cmus. If you want to do even more with cmus or change the keybindings, read the help I link to in this page's conclusion.
v - stop playback
b - next track
z - previous track
@jvkersch
jvkersch / ssh_auth_sock.md
Last active March 23, 2024 14:59
Updating SSH_AUTH_SOCK in an already established tmux session

I found this information somewhere on StackOverflow but I forgot exactly where. I'm paraphrasing what I learned here, for future reference.

SSH uses a Unix socket to communicate with other processes. The socket's path can be found by looking at the environment variable $SSH_AUTH_SOCK. When you re-connect to a tmux session that was started during a previous SSH session, this variable will contain the path of the previous SSH auth socket, and this will cause processes that try to connect to your authentication agent to fail. To fix this, we have to

  1. Create a symlink from the auth socket to a fixed path somewhere, so that we can refer to it later on. In ~/.ssh/rc, add
if test "$SSH_AUTH_SOCK"; then
	ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@madvas
madvas / partial-right.clj
Created June 13, 2015 12:40
Clojure partial-right (Like a partial, but arguments are added to the end)
(defn partial-right
"Takes a function f and fewer than the normal arguments to f, and
returns a fn that takes a variable number of additional args. When
called, the returned function calls f with additional args + args."
([f] f)
([f arg1]
(fn [& args] (apply f (concat args [arg1]))))
([f arg1 arg2]
(fn [& args] (apply f (concat args [arg1 arg2]))))
([f arg1 arg2 arg3]
@ivanoats
ivanoats / .railsrc
Last active August 11, 2020 09:33 — forked from gringocl/gist:8480696
# .railsrc
-B #Skip Bundle
-T #Skip Test-Unit
-d postgresql #Use postgres