Skip to content

Instantly share code, notes, and snippets.

View jbsulli's full-sized avatar

Joshua Sullivan jbsulli

  • Truepill
  • Austin, TX, USA
View GitHub Profile
@jbsulli
jbsulli / pnp typescript.md
Last active March 21, 2024 16:24
Typescript Yarn 3 Plug'n'Play zero-install monorepo for VSCode

Setup nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
source ~/.bashrc

Setup node

@jbsulli
jbsulli / request.json
Last active March 10, 2020 21:22
Courier Firebase overrides
{
"data": {
"name": "Joshua"
},
"event": "my-event",
"recipient": "josh",
"override": {
"firebase-fcm": {
"body": {
"data": {
@jbsulli
jbsulli / c_cpp_properties.json
Created October 2, 2019 19:15
VSCode ESP32 configuration
{
"configurations": [
{
"name": "Win32",
"includePath": [
"C:\\Users\\jb_su\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.4\\**",
"C:\\Users\\jb_su\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\**"
],
"forcedInclude": [
"C:\\Users\\jb_su\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.4\\cores\\esp32\\Arduino.h"
@jbsulli
jbsulli / extendObservable Issue.md
Last active April 3, 2018 18:17
MobX 4 extendObservable issue

The Problem:

Given the folloowing code:

class Jedi {
  @observable firstName = "";
  @observable lastName = "";

  constructor(options) {

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");

Query

  • document.querySelector(): returns first matching element
  • document.querySelectorAll(): returns all matching elements
  • document.getElementById(id)

DOM Node

  • addEventListener(event, cb)
  • appendChild(node)
  • childNodes
  • classList

What I learned - Image Resize on Cache Miss

The task:

I really wanted a way to create resized images on the fly just by specifying the size of the image in the request URL. So, if I had the image kitty.jpg but wanted to resize it to be 100px by 100px, would simply request kitty-100x100.jpg, the server would realize it doesn't exists and create it, and the resized image would be returned to me.

The solution:

I was following this guide written by John Pignata. It is an interesting solution and fit my needs but I did run into some caveats. Below are some of the gotchas I encountered.

1) There are two S3 domains you can point your CloudFront distribution at:

@jbsulli
jbsulli / app-academy-jumpstart-prep.md
Last active August 22, 2017 04:33
App Academy JumpStart Prep Notes

Primatives

  • string
    • .chars.count: block receives each char and method will return the number of truthy results
    • .split
    • .each_char: block called for each char with the current char as the argument
    • .with_index: when used with .each_char, will add a second argument, index, passed to the block
  • number
    • .even?/.odd?
    • .abs
    • .floor, .ceil, .round
@jbsulli
jbsulli / cmd.reg
Created May 16, 2017 02:38
Add "Open with CMD" option to the Windows 10 context menu (both when right-clicking on a folder and in a folder).
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWithCMD]
@="Open with CMD"
"Icon"="C:\\WINDOWS\\system32\\cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWithCMD\command]
@="cmd.exe /k cd %V"
[HKEY_CLASSES_ROOT\Directory\shell\OpenWithCMD]
@jbsulli
jbsulli / node-cli.md
Last active November 25, 2020 05:27
How to create a node command line integration module