Skip to content

Instantly share code, notes, and snippets.

@tj
tj / output
Last active October 18, 2018 04:12
#!/bin/sh
eval `go build -work -a 2>&1` && find $WORK -type f -name "*.a" | xargs -I{} du -hxs "{}" | gsort -rh | sed -e s:${WORK}/::g

Setup

Static files and 404 pages.

{{ mkdir "build" }}
{{ copy "static/*" "build" }}
{{ render "404" | write "build/404.html" }}
// grab time spent
sum := Agg("duration_sum", Sum("duration"))
// grab time spent per label
labels := Agg("labels",
Terms("issue.labels.keyword", 100),
Aggs(sum))
// grab time spent per day, and per label
// Package preact provides bindings to the preact library.
package preact
import "github.com/gopherjs/gopherjs/js"
var preact = js.Global.Get("preact")
// Attrs of an element.
type Attrs map[string]interface{}
{{ define "content" }}
{{ partial "back" (dict "url" "//apex.sh") }}
<section class="Content full center">
<div class="Container small">
<div class="Title center margin">
<span class="text">Status</span>
<span class="subtext">Apex service status.</span>
</div>
.Images.three {
--size: 450px;
--size-ratio: .75;
--size-small: calc(var(--size) * var(--size-ratio));
--inset: 150px;
--bottom: 25px;
display: flex;
justify-content: center;
align-items: flex-end;
}
@tj
tj / main.go
Last active April 10, 2017 06:58
package main
import (
"fmt"
"net/http"
"github.com/apex/go-apex"
"github.com/apex/go-apex/proxy"
)
@tj
tj / Makefile
Last active March 11, 2017 13:31
imgix favicons
IMAGE_CDN = https://apex-inc.imgix.net
# Imgix image replacement.
images:
@echo "==> pointing images to $(IMAGE_CDN)"
@find build -type f -name "*.html" | xargs sed -i '' 's|src="/images|src="$(IMAGE_CDN)/images|g'
@find build -type f -name "*.html" | xargs sed -i '' 's|href="/images|href="$(IMAGE_CDN)/images|g'
.PHONY: images
show_icons() {
defaults write com.apple.finder CreateDesktop true
killall Finder
}
hide_icons() {
defaults write com.apple.finder CreateDesktop false
killall Finder
}