Skip to content

Instantly share code, notes, and snippets.

View peacefixation's full-sized avatar

Matt Jarvis peacefixation

  • Melbourne, Australia
View GitHub Profile
@peacefixation
peacefixation / markdown-collapsible-element.md
Created November 2, 2023 04:52
Markdown collapsible element
NAME

Old

SELECT foo FROM bar
@peacefixation
peacefixation / gist:0e476e05f6c88579f012e47c746e1706
Created June 3, 2022 04:05
Curl POST request with JSON payload
curl -X POST -H "Content-Type: application/json" -d @data.json http://localhost:8000/endpoint
curl -X POST -H "Content-Type: application/json" -d @ '{"key1": "value1", "key2": "value2"}' http://localhost:8000/endpoint
@peacefixation
peacefixation / canvas.js
Last active December 27, 2021 01:40
Draw on a canvas
<html !doctype html>
<head>
<meta charset="UTF-8">
<script>
function draw() {
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
@peacefixation
peacefixation / config-overrides.js
Created November 4, 2021 05:19
Path rewrite for webpack dev server proxy
// https://webpack.js.org/configuration/dev-server/#devserverproxy
// https://github.com/chimurai/http-proxy-middleware
// https://github.com/chimurai/http-proxy-middleware#context-matching
// https://www.npmjs.com/package/micromatch
/* config-overrides.js */
module.exports = {
// The Webpack config to use when compiling your react app for development or production.
// webpack: function(config, env) {
@peacefixation
peacefixation / postgres-find-replace.sql
Created April 20, 2021 02:59
Postgres Find Replace
UPDATE table
SET column = REPLACE(column, 'find-str', 'replace-str')
WHERE id = X;
@peacefixation
peacefixation / git-checkout-pr.txt
Last active December 22, 2020 03:42
Github checkout pull request
# someone has forked my repo and created a pull request
# I want to review and test the code locally before I merge the pull request
# the pull request URL on Github (#4 in this case)
https://github.com/user/project/pull/4
# fetch the pull request (#4) and create a local branch called 'pr-4'
git fetch origin pull/4/head:pr-4
# checkout the local branch
@peacefixation
peacefixation / insert-select.sql
Created March 17, 2020 23:42
SQL insert from select
INSERT INTO table1(t1_col1, t1_col2, t1_col3)
SELECT t2_col1, t2_col2, t2_col3
FROM table2
WHERE condition = foo
@peacefixation
peacefixation / pprof.go
Last active March 11, 2020 06:20
Profile a Go program
import (
"fmt"
"os"
"github.com/pkg/profile"
)
func main() {
p := profile.Start(profile.CPUProfile, profile.ProfilePath("."), profile.NoShutdownHook)
defer p.Stop()
@peacefixation
peacefixation / records.txt
Last active August 23, 2019 03:10
Prog records for Abel
Aria - One [https://www.discogs.com/Aria-One/release/4996]
Austin Leeds - Moondiver [https://www.discogs.com/Austin-Leeds-Force-51/master/356216]
Cass & Slide - Diablo (Evolution Mix) [https://www.discogs.com/Cass-v-Slide-Diablo/master/34028]
D. Troy - Sixteen U (Antoine 909 Remix) [https://www.discogs.com/DTroy-Sixteen-U/release/408047]
Decepticons - Eastern Promise [https://www.discogs.com/Decepticons-Eastern-Promise/master/450988]
Decepticons - Deep Underground (Jade's journey through the underworld mix) [https://www.discogs.com/Decepticons-Deep-Underground/master/552944]
Deep Funk Project - 2 Heavy [https://www.discogs.com/Deep-Funk-Project-2-Heavy-Dirty-Logic/master/247225]
DJ Gogo - Anjuna [https://www.discogs.com/DJ-Gogo-Anjuna/release/163498]
Jimmy Van M - E.C.I-P.S [https://www.discogs.com/Jimmy-Van-M-ECI-PS/release/6087]
Osamu M - Moon Over [https://www.discogs.com/Osamu-M-Moon-Over/release/252977]