Skip to content

Instantly share code, notes, and snippets.

View tlindsay's full-sized avatar

Patrick Lindsay tlindsay

View GitHub Profile
@tlindsay
tlindsay / .golangci.yml
Created February 29, 2024 03:48
nilness with build-tags via golangci-lint
linters-settings:
govet:
disable-all: true
enable:
- nilness
@tlindsay
tlindsay / rust_playground.lua
Created October 5, 2022 14:14
Neovim buffer -> Rust Playground
function rust_playground(opts)
---@diagnostic disable-next-line: redefined-local
local opts = opts or {}
local copy = opts.copy or false
local open = opts.open or false
local char_to_hex = function(c)
return string.format('%%%02X', string.byte(c))
end
local function urlencode(url)
@tlindsay
tlindsay / build.sh
Created August 15, 2022 15:46
tinygo fetch bug
# tinygo version 0.25.0 darwin/amd64 (using go version go1.18 and LLVM version 14.0.0)
# go version go1.18.3 darwin/arm64
tinygo build -wasm-abi=generic -target=wasi -o bin/main.wasm main.go
/*
limitLoop.js - limit the frame-rate when using requestAnimation frame
Released under an MIT license.
When to use it?
----------------
A consistent frame-rate can be better than a janky experience only
occasionally hitting 60fps. Use this trick to target a specific frame-
rate (e.g 30fps, 48fps) until browsers better tackle this problem
@tlindsay
tlindsay / pick-branch.sh
Last active February 6, 2020 20:43
Choose a branch from an fzf list
git branch -lv | fzf | awk '{print $1}' | xargs git checkout
@tlindsay
tlindsay / pick-pr.sh
Created February 4, 2020 19:07
Choose open PR from a list and checkout
hub pr list | fzf | awk '{print $1}' | sed 's/\#//' | xargs hub pr checkout
@tlindsay
tlindsay / components.my-foo.js
Created August 14, 2019 20:57
lifecycle test
import Ember from 'ember';
export default Ember.Component.extend({
bar: null,
valAtInit: null,
valAtDRA: null,
init() {
this._super(...arguments);
console.log('init', this.bar);
@tlindsay
tlindsay / wipcheck.sh
Last active July 26, 2018 15:43
WIP Check Pre-commit Hook
#!/bin/sh
#
# This pre-commit hook will prevent you from continuing your work without resolving WIP commits
# It expects WIP commits to have the message `--wip-- [skip ci]`
#
# You can use the following commands to easily create and restore WIP commits:
# gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"'
# gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
#
# To enable this hook, rename this file to "pre-commit".
@tlindsay
tlindsay / Spotify-now-playing-on-TouchBar.scpt
Created June 23, 2017 15:36 — forked from LucaTNT/Spotify-now-playing-on-TouchBar.scpt
This script can be used in conjunction with Better Touch Tool to display the currently playing track in Spotify on the MacBook Pro TouchBar. More info here: https://lucatnt.com/2017/02/display-the-currently-playing-track-in-itunesspotify-on-the-touch-bar
-- This script can be used in conjunction with Better Touch Tool to display the currently playing track on the MacBook Pro TouchBar
-- More info here: https://lucatnt.com/2017/02/display-the-currently-playing-track-in-itunesspotify-on-the-touch-bar
if application "Spotify" is running then
tell application "Spotify"
if player state is playing then
return (get artist of current track) & " - " & (get name of current track)
else
return ""
end if
@tlindsay
tlindsay / svg.html
Created June 9, 2017 19:58
Horizontally and Vertically Center SVGs
<style>
.wrapper {
position: relative;
svg {
bottom: 50%;
left: 50%;
position: absolute;
right: 50%;
top: 50%;