Skip to content

Instantly share code, notes, and snippets.

Avatar

Emelia Smith ThisIsMissEm

View GitHub Profile
@fritzy
fritzy / 1_triggers.sql
Last active March 15, 2023 12:46
Get table change notifications from Postgres as JSON
View 1_triggers.sql
CREATE OR REPLACE FUNCTION table_update_notify() RETURNS trigger AS $$
DECLARE
id bigint;
BEGIN
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
id = NEW.id;
ELSE
id = OLD.id;
END IF;
PERFORM pg_notify('table_update', json_build_object('table', TG_TABLE_NAME, 'id', id, 'type', TG_OP)::text);
@holman
holman / emoji_test.rb
Last active June 18, 2020 01:27
A snapshot of the tests we use internally at GitHub to help edit our blog posts before they go out to everybody. For more information, take a peek at http://zachholman.com/posts/how-github-writes-blog-posts
View emoji_test.rb
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,
@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active March 19, 2023 15:37
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)
View _verify-repair-permissions-disk.md

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@rwaldron
rwaldron / helloworld.js
Created November 29, 2012 01:06 — forked from maxogden/helloworld.js
droneduino
View helloworld.js
var serialport = require('node-serialport')
var sp = new serialport.SerialPort("/dev/ttyO3", {
parser: serialport.parsers.raw,
baud: 9600
})
sp.on('data', function(chunk) {
console.log(chunk.toString('hex'), chunk.toString(), chunk)
})
@maxogden
maxogden / helloworld.js
Created November 27, 2012 06:55
droneduino
View helloworld.js
var serialport = require('node-serialport')
var sp = new serialport.SerialPort("/dev/ttyO3", {
parser: serialport.parsers.raw,
baud: 9600
})
sp.on('data', function(chunk) {
console.log(chunk.toString('hex'), chunk.toString(), chunk)
})
@csanz
csanz / whattobuy.md
Created November 22, 2012 16:30
Drone Specs
View whattobuy.md

#Drone Specs

Space Specs

  • Flat Area
  • Great wifi
  • Hopefully High ceilings without any crazy wires (eg. 120ft high ceilings in Berlin)

Spare parts

@isaacs
isaacs / streams.md
Created September 26, 2011 00:58
A spec for streams
View streams.md

Status of this Document

This is a proposal. It does not match the code as of writing.

This describes the minimum contract that Stream objects must adhere to in order to properly interoperate with pipes.

Stream Class

The parent class for all stream objects. Implements the pipe

View gist:924301
require 'rubygems'
require 'json'
require 'redis'
class RedisComments
def initialize(redis,namespace,sort_proc=nil)
@r = redis
@namespace = namespace
@sort_proc = sort_proc
end
View buildHTML utility.js
// my little html string builder
buildHTML = function(tag, html, attrs) {
// you can skip html param
var h = document.createElement(tag);
var attrs = attrs || {};
if (arguments.length == 2 && !((html) instanceof HTMLElement) && typeof(html) == "object") {
attrs = html;
html = null;
}