Skip to content

Instantly share code, notes, and snippets.

View nickytonline's full-sized avatar
🚀

Nick Taylor nickytonline

🚀
View GitHub Profile
@nickytonline
nickytonline / front-end-resources.md
Last active November 12, 2020 20:25
Some Front-End Resources
@nickytonline
nickytonline / async-awaitable-dom-event-handler.js
Last active May 2, 2024 17:30
async/await"able DOM event handlers
// async/await"able" DOM event handlers
async function getMeSomeData() {
// ...
return data
}
document.addEventListener('DOMContentLoaded', async () => {
const someContainer = document.getElementById('someContainer');
@nickytonline
nickytonline / tools-programs-for-osx.md
Last active May 12, 2021 19:58
Tools/Programs for devs on MacOS
  • Homebrew, run /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" from the command line to install it.
  • Homebrew Cask, run brew tap caskroom/cask from the command line to install it.
  • Alfred, buy the powerpack to get the full use of it.
  • Spectacle
  • Fish shell
  • VLC
  • Unarchiver
  • f.lux
  • n, run brew install n from the command line to install it.
  • Fisherman, run curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher from the command line to install it.
@nickytonline
nickytonline / hoc-cdc.jsx
Created October 29, 2017 18:03
HOC with componentDidCatch
import React, { Component } from 'react';
import Sentry from '../services/sentry';
import DevError from '../components/DevError';
const DEV_ENV = 'development';
const CaptureError = ({
ComponentToWrap,
ErrorComponent,
environment = process.env.NODE_ENV,
import test from 'ava';
import React from 'react';
import { shallow } from 'enzyme';
import CaptureError from '../CaptureError';
const render = ({
ComponentToWrap,
ErrorComponent,
environment = 'development',
}) => {
@nickytonline
nickytonline / async-await-promise-all.js
Last active August 12, 2018 07:43
async/await with Promise.all
// In response to https://twitter.com/housecor/status/930108010558640128
function doubleAfter2Seconds(x) {
return new Promise(resolve => {
resolve(x * 2);
}, 2000);
}
async function addAsync(x) {
const { a, b, c } = await Promise.all([
doubleAfter2Seconds(10),
interface Association<TKey, TValue> {
key: TKey;
info: TValue;
}
interface StringKeyInfo {
keyIndexes: Array<Association<string, number>>;
keyIsSet: Array<Association<string, boolean>>;
}
@nickytonline
nickytonline / customizing-vs-code.md
Last active April 27, 2024 00:44
Customizing VS Code for Two Fonts.

Customizing VS Code

I followed the instructions in this blog post Multiple Fonts: Alternative to Operator Mono in VSCode, but did not see any changes made to VS Code. After digging a bit, I discovered that all the CSS class names had changed. They’re now e.g. .mtk13, .mtk16 { … }.

Gotchas

  • Ensure it’s a file URL e.g. { "vscode_custom_css.imports": [ "file:///Users/Brian/Desktop/vscode-style.css" ] }
  • If you move the location of your file and update your user settings with the new location, you will need to disable and enable custom CSS cmd+shift+p.
  • Also, anytime you change the style in your custom CSS file, you need to disable, then re-enable the extension.

For reference

@nickytonline
nickytonline / my-mac-setup.sh
Last active October 22, 2023 12:09
Mac Setup Scripts
#!/bin/sh
# More Mac setup at https://mac.iamdeveloper.com
# Log file
timestamp=$(date +%s)
logFile="./my-mac-setup-$timestamp.log"
# if true is passed in, things will reinstall
reinstall=$1
@nickytonline
nickytonline / preview-head.html
Created July 11, 2018 13:48
Grid Points Background for Storybook
<style>
body {
background-image: linear-gradient(transparent 0px, transparent 1px, rgb(255, 255, 255) 1px, rgb(255, 255, 255) 20px), linear-gradient(to right, rgb(54, 69, 79) 0px, rgb(54, 69, 79) 1px, rgb(255, 255, 255) 1px, rgb(255, 255, 255) 20px);
background-position: 1.1875rem;
background-size: 1.25rem 1.25rem;
background-attachment: fixed;
}
</style>