Skip to content

Instantly share code, notes, and snippets.

@sanderhahn
sanderhahn / dynsql.sql
Created June 4, 2020 13:05
Dynamic sql table/columns
-- psql $HASURA_GRAPHQL_DATABASE_URL -f dynsql.sql
\set ON_ERROR_STOP on
drop schema if exists meta cascade;
create schema meta;
set search_path to 'meta', 'public';
drop table if exists db_column;
drop table if exists db_table;
@sanderhahn
sanderhahn / layout.html
Last active May 16, 2020 23:55
Golang Template Trouble
<html>
<head>
<title>{{ template "title" . }}</title>
</head>
<body>
{{ template "content" . }}
</body>
</html>
@sanderhahn
sanderhahn / main.go
Last active December 26, 2019 07:47
Graceful Server Shutdown in Go
package main
import (
"context"
"fmt"
"io"
"log"
"net/http"
"os"
"os/signal"
@sanderhahn
sanderhahn / application_controller.rb
Last active August 29, 2015 14:08
Resolve rails views from the database instead of the filesystem
class ApplicationController < ActionController::Base
cattr_accessor :template_resolver
def self.template_resolver
@template_resolver = @template_resolver || TemplateResolver.new
end
prepend_view_path self.template_resolver
end
@sanderhahn
sanderhahn / gulpfile.js
Last active September 11, 2019 14:45
Minify and templateCache your Angular Templates using Gulp
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var templates = require('gulp-angular-templatecache');
var minifyHTML = require('gulp-minify-html');
// Minify and templateCache your Angular Templates
// Add a 'templates' module dependency to your app:
// var app = angular.module('appname', [ ... , 'templates']);