Skip to content

Instantly share code, notes, and snippets.

View brianarn's full-sized avatar

Brian Sinclair brianarn

View GitHub Profile
@brianarn
brianarn / maths.js
Last active January 22, 2025 18:42
Module to wrap `console.group` around all methods
// A simple object with some methods,
// which throw errors when bad arguments are passed.
var maths = {
square : function (value) {
// Validity checking
if (arguments.length !== 1) {
throw new Error('square: Requires one and only one argument');
}
if (typeof value !== 'number') {
throw new Error('square: Requires numeric argument');
@brianarn
brianarn / Cube-of-Cubes.markdown
Created January 11, 2015 21:18
Cube of Cubes

Cube of Cubes

I attended this event and the talk was pretty great! Based on the talk and a little poking at documentation / Stack Overflow, I was able to easily put together this cube of cubes.

A Pen by Brian Arnold on CodePen.

License.

@brianarn
brianarn / keybase.md
Created April 15, 2016 20:36
keybase.md

Keybase proof

I hereby claim:

  • I am brianarn on github.
  • I am brianarn (https://keybase.io/brianarn) on keybase.
  • I have a public key whose fingerprint is D9E1 393A 2377 36EC 5BE5 6361 2662 4B1A 2AF3 B2AA

To claim this, I am signing this object:

@brianarn
brianarn / README.md
Created August 22, 2016 17:09
Random Docker things

As I learn about Docker and put together some things, I want to capture things in a place I can easily find later.

@brianarn
brianarn / fibdent.js
Created March 22, 2017 16:45
Fibonacci-based indentation
function topLevel() {
{
{
{
{
{
{
{
// Pretty
}
@brianarn
brianarn / akkala-lyrics.txt
Created April 4, 2017 21:43
Akkala (cover of "Africa" by Toto)
I hear no princess in the night
But Link hears all her whispers of defenestration
He’s coming in, paraglider flight
The sheikah slate reflects the past that guides him toward salvation
Got stopped by an old man along the way
Hoping to find some long forgotten tech or ancient memories
He turned to me as if to say, “Hurry boy, she’s waiting there for you"
It's gonna take a lot to clean up all that evil goo
There's nothing in a hundred years or more that they could do
@brianarn
brianarn / track-focus.js
Created June 6, 2017 03:40
Track focused element
(function () {
var focusedElement;
setInterval(function () {
if (focusedElement !== document.activeElement) {
focusedElement = document.activeElement;
console.log('Focused element changed:', focusedElement);
}
}, 50);
})();
@brianarn
brianarn / README.md
Last active December 17, 2019 05:45
Xfinity Garbage Modal Injection

Xfinity Modal Garbage

This month (November 2017) I exceeded my bandwidth cap with Xfinity. They started injecting this garbage in a TON of my insecure requests.

Another good argument for HTTPS everywhere: It would stop vendors from injecting garbage like this into requests.

June 27, 2018

They're doing it again. https://twitter.com/brianarn/status/1012099526713270272

@brianarn
brianarn / README.md
Last active May 24, 2018 21:21
Using `osascript` to issue notifications in MacOS

Thanks to a wonderful tip from @brianloveswords I've started using osascript alongside say to help me notice when long-running jobs are done.

You can also put a sound with the notification, which is cool, and I wanted a quick way to test every sound on the system, so I ran this:

for f in /System/Library/Sounds/*.aiff
do
file=$(basename -s .aiff $f)
osascript -e "display notification \"$file\" with title \"$file\" sound name \"$file\""
sleep 1
@brianarn
brianarn / objectPromiseAll.js
Created May 29, 2018 21:56
like `Promise.all` but for plain non-iterable objects
// Based on inspiration from some conversation in WeAllJS
// See wealljs.org for more info on the community!
// This is assuming a plain JS object which is why it's not using for-of, since
// plain objects aren't iterable
function objectPromiseAll(baseObject) {
return Promise.all(Object.values(baseObject)).then((resolvedValues) => {
const resolvedObject = {};
Object.keys(baseObject).forEach((key, index) => {