Skip to content

Instantly share code, notes, and snippets.

View calvinmetcalf's full-sized avatar

Calvin Metcalf calvinmetcalf

View GitHub Profile
export default async (knex) => {
const foreignKeys = await knex('pg_constraint')
.select('pg_constraint.conname', 'pg_class.relname')
.where('contype', '=', 'f')
.join('pg_class').on('pg_class.oid', 'pg_constraint.conrelid');
return Promise.all(foreignKeys.map(({relname, conname}) =>
knex.schema.raw(`
ALTER TABLE ??
ALTER CONSTRAINT ??
DEFERRABLE INITIALLY DEFERRED;
@calvinmetcalf
calvinmetcalf / .block
Created March 3, 2017 21:00 — forked from mbostock/.block
U.S. Population Density
license:gpl-3.0
height:680
border:no
@calvinmetcalf
calvinmetcalf / index.html
Last active August 9, 2016 19:39 — forked from ramiroaznar/index.html
How to remove a CARTO layer interactivity + GMs
<!DOCTYPE html>
<html>
<head>
<title>GMs and CARTO.js | Remove interactivity</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
@calvinmetcalf
calvinmetcalf / .block
Last active May 13, 2016 20:25 — forked from mbostock/.block
N-Body Problem
license: gpl-3.0
@calvinmetcalf
calvinmetcalf / theme.html
Last active December 19, 2015 06:19 — forked from soemarko/theme.html
<!-- Add the following lines to theme's html code right before </head> -->
<link rel="stylesheet" href="//gist.github.com/assets/embed-bfcadee384027982121fdeb9930e78b2.css" />
<!-- add the folowing if jquery isn't already included in your theme-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<!-- add the following to the bottom of the theme-->
<script>
$(function() {
function makeGist(d){
var link = $($(d).html())[0];
Google Glass
State of the Map US - http://stateofthemap.us
Single page apps versus frameworks
Traveling and visiting foreign countries
FOSS-4G NA
OSM-Plus - http://osmplus.co
iD, the new OSM editor - http://www.spatiallyadjusted.com/2013/05/07/mapboxs-openstreetmap-editor/
Esri's REST API being an OGC standard - http://lists.osgeo.org/pipermail/discuss/2013-May/011599.html
and should we care about OGC standards when things like geojson just work http://lists.geojson.org/pipermail/geojson-geojson.org/2013-April/000706.html
Renting ArcGIS - http://spatiallyadjusted.com/2013/05/06/arcgis-cloud-is-in-your-future/
// In this example, I want to create a stream that pipes a file through a
// transform, *without* beginning to read data from the file. I want the
// whole pipeline to be lazy until I call read() on the end of the pipeline.
//
// Instead, the console.log() call fires unexpectedly.
var fs = require('fs'),
stream = require('stream');
var dest = new stream.Transform({highWaterMark:0});
// In this example, I want to create a stream that pipes a file through a transform,
// *without* beginning to read data from the file. I want the whole pipeline to be
// lazy until I call read() on the end of the pipeline.
//
// Instead, the console.log() call fires unexpectedly with every line of the file.
var fs = require('fs'),
split = require('split'),
stream = require('stream');
(function() {
'use strict';
var dbname = 'idb://pouch_intro';
var db = new PouchDB(dbname, function(err, pouchdb){
if(err){
alert("Can't open pouchdb database");
}else{
<html>
<body>
<script src="//cdn.jsdelivr.net/jquery/2.1.1/jquery.js"></script>
<script src="//cdn.jsdelivr.net/handlebarsjs/1.3.0/handlebars.amd.js"></script>
<script src="//cdn.jsdelivr.net/emberjs/1.5.1/ember.js"></script>
<script src="//cdn.jsdelivr.net/pouchdb/2.2.0/pouchdb.js"></script>
<script src="index.js"></script>
</body>
</html>