Skip to content

Instantly share code, notes, and snippets.

View ARHEIO's full-sized avatar

Adam RH Eggleston ARHEIO

View GitHub Profile
@ARHEIO
ARHEIO / index.js
Last active February 15, 2023 05:35
Deno can import this
class MyTitle extends HTMLElement {
connectedCallback() {
this.innerHTML = `
<style>
h1 {
font-size: 2.5rem;
color: hotpink;
font-family: monospace;
text-align: center;
text-decoration: pink solid underline;
@ARHEIO
ARHEIO / ReactContext.tsx
Created January 16, 2023 02:38
Render Props vs React Context
import React, { createContext, PropsWithChildren, useContext } from 'react';
type OnMouseClickEvent = React.MouseEvent<HTMLButtonElement, MouseEvent>;
const DemoContext = createContext<{
onClick: (ev: OnMouseClickEvent) => void;
}>({
onClick: () => undefined,
});
@ARHEIO
ARHEIO / Makefile
Last active August 28, 2022 04:51
Makefile with a builtin help
# -----------------------------------
# MAKEFILE VARS
# -----------------------------------
.DEFAULT_GOAL := help
.PHONY: test
# -----------------------------------
# MAKE TARGETS
@ARHEIO
ARHEIO / do.sh
Created July 26, 2021 02:32
Do something with bash script
#!/bin/bash
set -euo pipefail
function print_bold {
local text_bold=$(tput bold)
local text_normal=$(tput sgr0)
echo "${text_bold}$1${text_normal}"
}
@ARHEIO
ARHEIO / consoleColors.js
Created July 26, 2021 02:31 — forked from abritinthebay/consoleColors.js
The various escape codes you can use to color output to StdOut from Node JS
// Colors reference
// You can use the following as so:
// console.log(colorCode, data);
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`);
//
// ... and so on.
export const reset = "\x1b[0m"
export const bright = "\x1b[1m"
export const dim = "\x1b[2m"
@ARHEIO
ARHEIO / ~-.config-karabiner-karabiner.json
Created March 17, 2020 04:42
Karabiner Config for Preonic
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@ARHEIO
ARHEIO / placeholderVmixinInput.scss
Last active October 15, 2019 00:39
The difference between scss placeholders and scss mixins
// ----
// Sass (vundefined)
// Compass (vundefined)
// dart-sass (v1.18.0)
// ----
$MYBLUEEYES: #3587DA;
@mixin card {
border: 1px solid $MYBLUEEYES;
const date = new Date();
function createProperISOString(date) {
const dateTime = date.toISOString().slice(0, 19);
const timezoneOffset = -date.getTimezoneOffset() / 60;
let timezoneOffsetAsHours
if (Number.isInteger(timezoneOffset)) {
timezoneOffsetAsHours = `${('0' + Math.abs(timezoneOffset)).slice(-2)}:00`;
} else {
@ARHEIO
ARHEIO / aws-sns-message-push.js
Last active April 16, 2019 06:33
Example Lambda that takes an event with a message and a message attribute and injects it into an ARN
/**
* This is an example body that you would pass in through the test function
* {
* "snsMessage": "This is a test body that will come through",
* "messageAttributes": {
* "insurance_type": {
* "DataType": "String",
* "StringValue": "car"
* }
* }
// GIST to find pairs of numbers within an array that is greater than the sum of all numbers in the array
// first GOTCHA, make sure you don't multiply a number by itself
// second GOTCHA, make sure numbers aren't multiplied in reverse! (eg 10 * 8 and 8 * 10)
function bruteForce() {
// unsorted list
var list = [ 3, 10, 4, 9, 8, 7 ];
// sum of all numbersin list