Skip to content

Instantly share code, notes, and snippets.

timwis / foreign_keys.sql
Last active November 15, 2023 20:05
Get foreign keys
con.oid as "constraint_oid",
conname as "constraint_name",
pg_catalog.pg_get_constraintdef(con.oid, true) as "constraint_definition",
conrelid as "constrained_table_oid",
col.attname as "constrained_column_name",
confrelid as "referenced_table_oid",
ref.attname as "referenced_column_name"
FROM pg_catalog.pg_constraint as con
CROSS JOIN UNNEST(conkey) WITH ORDINALITY as constrained_cols(col_num, col_index)
timwis / LocationInput.vue
Last active December 19, 2021 15:08
Nested components with v-model
@select="option => selected = option"
timwis / orcsv
Created September 20, 2019 15:33
Import and export CSV files with orc
#!/usr/bin/env bash
import () {
csvjson "${3:-/dev/stdin}" \
| jq --raw-output '.[] | @sh "echo orc add-entry '"$1"' user \(.'"$2"') \(tostring)"' \
| xargs -0 bash -c
export_ () {
orc ls "$1" user | cut -f 4 | in2csv -f ndjson
timwis / App.vue
Created February 19, 2019 12:51
Using mapbox-gj-leaflet with Vue2Leaflet
<LMap id="map" :center="center" :zoom="zoom">
:tile-layer-class="tileLayerClass" />
import { LMap, LTileLayer } from 'vue2-leaflet'
timwis /
Last active February 8, 2019 12:12

problem statement

  • enterprises will inevitably have more data being collected and maintained than their IT departments can keep up with, so business users resort to using spreadsheets or proprietary/incompatible tools.
  • hard to share or integrate this data with other systems
  • eventually the IT departments have to come in and build on top of or fix these tools (crazy formatting, having to reverse engineer the export)
  • there isn't really a great alternative
    • access: desktop software, outdated, not multi-user.
    • airtable: prioprietary, saas-only and could disappear/pivot.
    • salesforce: expensive, proprietary, easy to cross the line where it's very difficult to port (e.g. workflows, notifications).


import { mapActions, mapState } from 'vuex'
export default {
computed: mapState({
services: (state) =>
methods: mapActions([
async created () {
timwis /
Created December 31, 2017 03:08
Keybase proof

Keybase proof

I hereby claim:

  • I am timwis on github.
  • I am timwis ( on keybase.
  • I have a public key ASDZvrXjQGJWWeDkYoCfyTS1tZaempyiVUgGSj0wMRJkhwo

To claim this, I am signing this object:

timwis / Map.vue
Created November 9, 2017 18:08
city basemap example
<template lang="pug">
import L from 'leaflet'
import esri from 'esri-leaflet'
import 'leaflet-easybutton'
export default {
const Nestable = require('react-nestable').default
const React = require('react')
const ReactDOM = require('react-dom')
const Nanocomponent = require('nanocomponent')
const css = require('sheetify')
module.exports = class TaskList extends Nanocomponent {
const html = require('bel')
window.CustomButton = function (props) {
console.log('Called CustomButton', props)
return html`
<button style="background-color: ${props.color}">