Skip to content

Instantly share code, notes, and snippets.

View mbbroberg's full-sized avatar
:octocat:
Mostly in enterprise github lately

Matthew Broberg mbbroberg

:octocat:
Mostly in enterprise github lately
View GitHub Profile
javascript: {
function replaceTokens(e, t) {
var n = e;
for (var r in t) {
n = n.replace(RegExp("[$]" + r, "g"), t[r])
}
return n
}
@mbbroberg
mbbroberg / gist:b94998721491c07ba30a
Last active August 29, 2015 14:27 — forked from sdebnath/gist:36c235e042cb35db7d1f
Add field to Riak YZ Schema with CRDTs
This gist captures what needs to be done to add a new field to Riak's Yokozuna
search index.
Sources:
- https://github.com/basho/yokozuna/issues/130
- http://riak-users.197444.n3.nabble.com/How-to-update-existed-schema-td4032143.html
The code below is for illustration purposes only. Use at your own risk.
1. Create/Update new schema file
@mbbroberg
mbbroberg / run-snapd.sh
Created January 5, 2016 21:59 — forked from jcooklin/run-snapd.sh
starts a snap tribe, loads plugins and starts a task
#!/bin/bash
typeset -i num
num=6
echo "starting seed"
$SNAP_PATH/bin/snapd --tribe --tribe-port 6000 --tribe-addr 127.0.0.1 --tribe-node-name seed --api-port 8181 -l 1 -t 0 --enable-instrumentation 2>&1 > /tmp/p-seed.out &
echo "starting $num snap agents"
for ((i=1;i<num;i++))
do
sleep .1

about accepting contributions on open source projects. This guide is designed as a TL;DR broken out into three sections:

  1. The issue
  2. The reason it happens
  3. How to improve

I hope this helps you reflect on your contribution processes and improves your community (and its code).

"unfit" patches

@mbbroberg
mbbroberg / ct.fish
Created August 1, 2016 01:57 — forked from tlockney/ct.fish
function ct
# infer a session name from the current dir and normalize it for a valid tmux session name
set -g session (basename (pwd) | sed 's/[\.\-]/_/g')
tmux attach -t $session; or tmux new-session -s $session
end
module.exports = async (params) => {
console.log("Starting...")
console.log(params);
const currentFile = params.app.workspace.getActiveFile();
if (!currentFile) {
new Notice("No active file.");
return;
}
console.log("Found active file: ", currentFile.basename);