Skip to content

Instantly share code, notes, and snippets.

View mtHuberty's full-sized avatar

Matt Huberty mtHuberty

  • Technology Partners
  • St. Louis, MO
View GitHub Profile
@mtHuberty
mtHuberty / errorHandling.js
Last active July 19, 2021 23:48
A nice lil' JS error handling pattern
function thisThrows() {
throw new Error('Original error')
}
function thisAddsContextAndThrowsAgain() {
try {
thisThrows()
} catch(err) {
err.message = 'More info: ' + err.message
err.statusCode = 404
@mtHuberty
mtHuberty / channels_and_select.go
Last active January 23, 2021 05:52
Concurrency in Golang
package main
import (
"golang.org/x/tour/tree"
"fmt"
)
// Solving https://tour.golang.org/concurrency/8
// Walk walks the tree t sending all values
@mtHuberty
mtHuberty / extract.js
Created December 23, 2020 19:05 — forked from leobossmann/extract.js
Extract and rename images from Pixieset
var imgs = new Array;
// replace all images by the xxl version
$('li > img').each(function(i, item){
var new_src = $(item).prop('src').replace('large', 'xxlarge');
$(item).prop('src', new_src);
imgs.push($(item));
});
// kill everything on page
$('body').empty();
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">