Skip to content

Instantly share code, notes, and snippets.

View garth's full-sized avatar

Garth Williams garth

View GitHub Profile
@garth
garth / init.coffee
Last active May 17, 2018 09:02
Atom Settings
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@garth
garth / checkpoint.sh
Created December 22, 2016 15:45 — forked from phoob/checkpoint.sh
#!/bin/bash
#
# The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext
# which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just
# from time to time
# Usage: checkpoint.sh
# The script checks if Enpoint Security VPN is running. If it is, then it shuts it down, if it is not, it fires it up.
# Or, make an Automator action and paste the script.
# You will need sudo power, of course
#
@garth
garth / CurvedText.js
Created December 22, 2017 10:41
React component for making curved text
/*
Draws text around a circule (the object).
Text is centered at the top of the circle.
Depends on styled-components, but can be adapted for other frameworks.
<CurvedText
text="I'm curved"

Keybase proof

I hereby claim:

  • I am garth on github.
  • I am garthw (https://keybase.io/garthw) on keybase.
  • I have a public key ASCbrYdBQl2XRHArhXi1mNP2LYfoQV28BuArnB4uknDI7go

To claim this, I am signing this object:

@garth
garth / settings.json
Last active May 14, 2021 15:15
VS Code
{
"cSpell.language": "en-GB",
"editor.autoClosingBrackets": "never",
"editor.autoClosingQuotes": "never",
"editor.cursorStyle": "line",
"editor.emptySelectionClipboard": false,
"editor.folding": false,
"editor.fontFamily": "MonoLisa, 'JetBrains Mono', 'Fira Code Retina', 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.fontSize": 13,
@garth
garth / gnome_terminal_settings.txt
Created October 28, 2018 20:54
Nova gnome terminal settings
[legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9]
foreground-color='rgb(197,212,221)'
visible-name='Nova'
palette=['rgb(60,76,85)', 'rgb(223,140,140)', 'rgb(168,206,147)', 'rgb(218,218,147)', 'rgb(131,175,229)', 'rgb(154,147,225)', 'rgb(127,193,202)', 'rgb(197,212,221)', 'rgb(137,155,166)', 'rgb(242,195,143)', 'rgb(168,206,147)', 'rgb(218,218,147)', 'rgb(131,175,229)', 'rgb(209,142,194)', 'rgb(127,193,202)', 'rgb(230,238,243)']
default-size-rows=40
default-size-columns=140
cursor-background-color='rgb(127,193,202)'
cursor-shape='block'
cursor-colors-set=true
highlight-colors-set=false
@garth
garth / App.tsx
Last active November 29, 2018 10:22
A simple router using page.js and applied using react hooks
import React, { useState } from 'react'
import { routes } from './routes'
import { useRouter } from './router-hook'
const App: React.StatelessComponent = () => {
const route = useRouter(routes)
return (
<div>
<h1>{route.name}</h1>
</div>
@garth
garth / Login.tsx
Created November 23, 2018 13:46
A simple form manager with react hooks
import React from 'react'
import { useForm } from './forms-hook'
const formDefinition = {
username: { value: '', isValid: value => value.length > 0 },
password: { value: '', isValid: value => value.length > 0 }
}
const Login: React.StatelessComponent = () => {
const [form, setField] = useForm(formDefinition)
// This would be the client in the npm package
export const plausible: (arg: 'page' | 'trackPushState') => void = (window['plausible'] =
window['plausible'] ||
function(
...args: any[] // eslint-disable-line
) {
;(window['plausible'].q = window['plausible'].q || []).push(args)
})
const js = document.createElement('script')
js.id = 'plausible'
@garth
garth / volta.docker
Created May 24, 2021 15:18
Docker image roughly based on the offical node images, but with support for projects with mixed node versions via Volta
FROM debian:buster
# curl and ca-certificates are needed for volta installation
# git, python and build-essential are needed for legacy package dependencies
RUN apt-get update \
&& apt-get install -y \
curl \
ca-certificates \
git \
python \