Skip to content

Instantly share code, notes, and snippets.

App.mydb.changes({
since: 'now',
live: true
}).on('change', function(docChanges) {
console.log('changed', docChanges)
if (docChanges.deleted) {
var underscore = docChanges.id.indexOf('_'),
docType = docChanges.id.substring(0, underscore),
docId = docChanges.id.substring(docChanges.id.indexOf('_', underscore + 1) + 1);
var restify = require('restify');
function respond(req, res, next) {
res.send(req.params);
next();
}
var server = restify.createServer();
server.use(restify.bodyParser());
@alexmipego
alexmipego / f-bind
Created August 25, 2021 00:16
f-bind — ZSH auto run command
#!/bin/zsh
# Explanation
# I've my mac setup so pressing F13-F19 will touch a file like ~/scripts/global-f13.watch.
# If I now run a command, say "make", and afterwards I run ". f-bind 13", then upon
# pressing F-13, the shell with automatically queue a "make" + <ENTER>.
# This preserves history, allows me to use a single shell, and doesn't interrupt
# other processes (say "man ls" for example).
if [[ $ZSH_EVAL_CONTEXT == 'toplevel' ]]; then