Skip to content

Instantly share code, notes, and snippets.

View nickytonline's full-sized avatar
🚀

Nick Taylor nickytonline

🚀
View GitHub Profile
@nickytonline
nickytonline / settings.jsonc
Created May 5, 2024 18:25
Latest VS Code Settings
{
// miscellaneous
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always",
"diffEditor.ignoreTrimWhitespace": false,
// window
"window.title": "🦙⚡🫡 – ${activeEditorShort}${separator}${rootName} – 🫡⚡🦙",
"window.clickThroughInactive": false,
@nickytonline
nickytonline / my-mac-setup.sh
Last active May 5, 2024 07:33
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 / 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 / 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 / paste.js
Last active January 25, 2024 06:01
Simulate a paste event in Cypress
/**
* Simulates a paste event.
*
* @param pasteOptions Set of options for a simulated paste event.
* @param pasteOptions.destinationSelector Selector representing the DOM element that the paste event should be dispatched to.
* @param pasteOptions.pastePayload Simulated data that is on the clipboard.
* @param pasteOptions.pasteFormat The format of the simulated paste payload. Default value is 'text'.
*/
function paste({ destinationSelector, pastePayload, pasteType = 'text' }) {
// https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event
@nickytonline
nickytonline / createElement.js
Last active July 4, 2023 17:21
A Handy DOM element creation function.
// Inspired from Sam Thorogood's article, https://dev.to/chromiumdev/beyond-appendchild-better-convenience-methods-for-html-55n4
function createElement(nodeName, props) {
const { style = {}, ...propsNoStyle } = props;
const element = Object.assign(document.createElement(nodeName), propsNoStyle);
Object.entries(style).forEach(([key, value]) => { element.style[key] = value; });
return element;
}
@nickytonline
nickytonline / tweet-ublock-filters.md
Last active December 24, 2022 04:08
Filters to hide a Tweets number of views 📊

Go to your filters and add the following to hide (for yourself only), the number of views for a Tweet. See https://www.freecodecamp.org/news/how-to-block-content-from-web-pages-using-ublock-origin/ if you've never used uBlock filters

twitter.com##[id^="id__"] > div.r-1h0z5md.r-18u37iz.css-1dbjc4n > .r-lrvibr.r-bztko3.r-1ny4l3l.r-bt1l66.r-1777fci.r-1loqt21.css-1dbjc4n.css-18t94o4.css-4rbku5 > .r-qvutc0.r-3s2u2q.r-clp7b1.r-o7ynqc.r-bcqeeo.r-rjixqe.r-1h0z5md.r-16dba41.r-a023e6.r-37j5jr.r-6koalj.r-1bwzh9t.r-1awozwy.css-901oao > .r-1udh08x.r-xoduu5.css-1dbjc4n > span
twitter.com##[id^="id__"]  > div.r-1h0z5md.r-18u37iz.css-1dbjc4n > .r-lrvibr.r-bztko3.r-1ny4l3l.r-bt1l66.r-1777fci.r-1loqt21.css-1dbjc4n.css-18t94o4.css-4rbku5 > .r-qvutc0.r-3s2u2q.r-clp7b1.r-o7ynqc.r-bcqeeo.r-rjixqe.r-1h0z5md.r-16dba41.r-a023e6.r-37j5jr.r-6koalj.r-1bwzh9t.r-1awozwy.css-901oao > .r-xoduu5.css-1dbjc4n > .r-1hdv0qi.r-lrvibr.r-1plcrui.r-bnwqim.r-dnmrzs.r-1xvli5t.r-yyyyoo.r-4qtqp9
twitter.com##.r-1mf7evn.css-1dbjc4n > .css-1dbjc4n > 
import "https://deno.land/x/dotenv/load.ts";
const response = await fetch("https://www.getrevue.co/api/v2/issues", {
headers: {
Authorization: `Token ${Deno.env.get("REVUE_API_KEY")}`,
},
});
const issues = await response.json();
@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.