start new:
tmux
start new with session name:
tmux new -s myname
// First argument (or array element for nested arrays) is tag name. | |
// Second can optionally be an object, in which case it is used to | |
// supply attributes. All others are added to the tag's body. | |
html("p", {"class": "foo"}, "hello world", "!") | |
'<p class="foo">hello world!</p>' | |
// Shortcuts for denoting id and class attributes | |
html("p#foo.bar.baz", "hello world!") | |
'<p id="foo" class="bar baz">hello world!</p>' |
(defn uuid [] (str (java.util.UUID/randomUUID))) |
App configuration in environment variables: for and against | |
For (some of these as per the 12 factor principles) | |
1) they are are easy to change between deploys without changing any code | |
2) unlike config files, there is little chance of them being checked | |
into the code repo accidentally | |
3) unlike custom config files, or other config mechanisms such as Java |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
EDIT from 2019: Hi folks. I wrote this gist for myself and some friends, and it seems like it's gotten posted somewhere that's generated some (ahem, heated) discussion. The whitespace was correct when it was posted, and since then GitHub changed how it formats (thank you @anzdaddy for suggesting a formatting workaround) honestly this is a random throwaway gist from 2015, and someone more knowledgable about this comparison should just write a proper blog post about it. If you comment here I'll hopefully see it and stick a link to it up here. Cheers. @oconnor663<pre>
tags. Look at the raw text if you care about this. I'm sure someone could tell me how to fix it, but
Here's the canonical TOML example from the TOML README, and a YAML version of the same.
title = "TOML Example" |
;; modify ob-js to redirect to skewer if it is currently connected | |
;; this code can go in an emacs settings file | |
(require 'ob-js) | |
(require 'cl) | |
(advice-add 'org-babel-execute:js :around 'bill/org-babel-execute:skewer) | |
;;(advice-remove 'org-babel-execute:js #'bill/org-babel-execute:skewer) | |
(defun bill/org-babel-execute:skewer (oldFunc body params) | |
(if (skewer-ping) | |
(lexical-let* ((result-type (cdr (assoc :result-type params))) |
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: