Skip to content

Instantly share code, notes, and snippets.

View jmg1138's full-sized avatar
๐Ÿ˜
Loving my work

Joshua Gray jmg1138

๐Ÿ˜
Loving my work
View GitHub Profile
@jmg1138
jmg1138 / hummingbird-feeders.md
Last active May 18, 2022 21:18
Hummingbird Feeder Information
@jmg1138
jmg1138 / snake-to-camel-keys-exercise.js
Last active March 9, 2022 13:07
Snake case to camel case object keys exercise.
/**
* Snake-to-camel exercise.
* - Convert the keys of a JSON object from snake_case to camelCase.
* - Include nested/child objects.
* - Do not mutate the original object.
*/
/**
* Determine if a value is an object.
* - Is a non-null Object (value === Object(value))
@jmg1138
jmg1138 / javascript_event_loop.md
Last active March 9, 2022 13:09
The JavaScript Event Loop

JavaScript Event Loop

Some notes from these sources:

JavaScript has a runtime model based on an event loop, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks.

When running Node.js, operations may be offloaded to the system kernel whenever possible, to enable non-blocking I/O opererations despite the single-threaded nature of JavaScript.

@jmg1138
jmg1138 / working-out-dependabot-alerts.md
Last active February 5, 2022 06:19
How I Work Out GitHub Dependabot Alerts

Working through GitHub Dependabot alerts

So, Dependabot is alerting me about a "moderate serverity" problem with socket.io. It is recommending that I upgrade socket.io to version 2.4.0 or later.

I do not have socket.io in my package.json dependencies for the project/repo that I'm working in and getting this alert, so I have to try and figure out what dependency I am using that is ending up requiring socket.io.

yarn why

I happen to be using yarn in this project, and have a yarn.lock file. So, I'm going to use yarn why to figure out what is requiring socket.io and using the version with the problem. I could use npm ls if I were using a package.lock file.

@jmg1138
jmg1138 / uninstall-chrome-kubuntu.md
Created September 18, 2020 16:50
Uninstall Chrome browser in Kubuntu

How to uninstall Chrome browser in Kubuntu

First, list installed software, and find the one that says "google-chrome-stable".

$ dpkg --list

Once you've confiremd it is there, and that is the name, uninstall it.

@jmg1138
jmg1138 / this without bind.md
Last active March 9, 2022 13:09
Preserve lexical scope of `this.` in Typescript without using `bind()`

Preserve lexical scope of this. in Typescript without using bind()

Side effect: You will not be able to override/overload the method using this syntax.

From this stackoverflow

If the following declaration for methods isn't working:

export class myClass
@jmg1138
jmg1138 / shrink-windows.md
Last active May 15, 2020 18:17
Remove Windows pagefile.sys to free up disk space and shrink partition or VM drive

Shrinking a partition or VM drive

I run into this occasionally, mostly with a Windows VM, needing to shrink a partition or VM drive, so I thought I would make some notes here for myself for when I do this again in the future.

Backup

Have multiple copies in multiple locations of a complete backup.

Cleanup

@jmg1138
jmg1138 / jitsi-meet-tips-for-windows-10.md
Last active May 4, 2020 06:35
Jitsi-Meet Tips For Windows 10 Users

Jitsi Meet tips for Windows 10 users

Try the WebRTC Troubleshooter

Turn off Windows 10 Spatial sound

This is also known as "Windows Sonic". This can cause a HORRIBLE echo effect.

@jmg1138
jmg1138 / React-event-bind.md
Last active March 4, 2020 23:52
React event handler fires unexpectedly during render.

React events and binding

While becoming familiar with React/Redux, I ran into an unexpected behavior. I used an onClick event handler for a list item, and when the parent component's render() function was called my event handler function was also called.

I thought, "But, I didn't click anything. Why is my event handler firing?"

Here's what I've found (hopefully I understand this as well as I think I do right now).

My code

@jmg1138
jmg1138 / xml-to-string-variable.md
Created March 2, 2020 23:34
Assign XML content to a string in C#