Skip to content

Instantly share code, notes, and snippets.

@thheller
thheller / basic-example.clj
Last active February 11, 2016 13:48
clojure.core.async pub/sub
(def my-topic (pubsub/topic 100))
(pubsub/subscribe-go
[subscription my-topic (sliding-buffer 100)]
(loop []
(when-let [ev (<! subscription)]
(prn [:sub-got ev])
(recur))))
;; without go
@esycat
esycat / PrettyPrinter.groovy
Last active November 5, 2024 13:54
A simple way to pretty print nested lists and maps in Groovy.
import static groovy.json.JsonOutput.*
def config = ['test': 'lalala']
println prettyPrint(toJson(config))
@joshnuss
joshnuss / mnesia.exs
Last active March 9, 2024 00:32
Elixir example code for accessing mnesia databases
# define a record, first attribute is considered the key
defrecord User, email: "", first: "", last: ""
# encapsulates mnesia calls
defmodule Database do
def create_schema do
create_table User
end
def find(record, id) do
@djKianoosh
djKianoosh / _.merge.js
Last active December 26, 2015 03:59
Underscore mixin to merge objects; last item takes precedence (uses _.extend not _.default)
/**
* Underscore mixin to merge objects; last item takes precedence (uses _.extend not _.default)
**/
_.mixin({
merge : function() {
return _.reduce(arguments, function(list, obj){
return _.extend(list, obj);
}, {});
}
@trey
trey / hubot-slack-heroku.md
Last active October 25, 2021 03:18
Steps to Install Hubot in Slack using Heroku
@joyrexus
joyrexus / README.md
Created March 28, 2014 16:59
Nested grouping of arrays

nest.js

A multi-level groupBy for arrays inspired by D3's nest operator.

Nesting allows elements in an array to be grouped into a hierarchical tree structure; think of it like the GROUP BY operator in SQL, except you can have multiple levels of grouping, and the resulting output is a tree rather than a flat table. The levels in the tree are specified by key functions.

See this fiddle for live demo.

@staltz
staltz / introrx.md
Last active July 13, 2025 10:33
The introduction to Reactive Programming you've been missing
@tonymtz
tonymtz / gist:714e73ccb79e21c4fc9c
Created November 15, 2014 00:02
Uninstall XQuartz.app from OSX Yosemite
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in
@yunano
yunano / consul-template.service
Created May 1, 2015 15:54
/etc/systemd/system/consul-template.service
[Unit]
Description=consul-template
Requires=network-online.target
After=network-online.target consul.service vault.service
[Service]
EnvironmentFile=-/etc/sysconfig/consul-template
Restart=on-failure
ExecStart=/usr/local/sbin/consul-template $OPTIONS -config=/etc/consul-template.d
@pkoppstein
pkoppstein / schema.jq
Last active April 28, 2025 23:20
schema.jq
module {
"name": "schema",
"description": "JSON Schema Inference",
"version": "0.0.3.1",
"homepage": "https://gist.github.com/pkoppstein/a5abb4ebef3b0f72a6ed",
"license": "MIT",
"author": "pkoppstein at gmail dot com"
};
# NEWS: