Skip to content

Instantly share code, notes, and snippets.

View ericeslinger's full-sized avatar

Eric Eslinger ericeslinger

View GitHub Profile
@ericeslinger
ericeslinger / Client Updates with Listen - Notify in PostgreSQL.md
Last active October 6, 2016 13:04
Postgres Listen/Notify for automatic updates

Listen / Notify for automatic object updates - pattern in postgreSQL Presented at the San Francsico PostgreSQL User Group Meetup 8/17/15

by Eric Eslinger eric.eslinger@gmail.com github.com/ericeslinger

This example uses listen/notify calls in PostgreSQL that trigger on row update to pass events from the database to a listening node.js web application that in turn uses socket.io to pass events

#!/bin/sh
# http://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes
require_clean_work_tree () {
# Update the index
git update-index -q --ignore-submodules --refresh
err=0
# Disallow unstaged changes in the working tree
if ! git diff-files --quiet --ignore-submodules --; then