Skip to content

Instantly share code, notes, and snippets.

joemaller / conversion.js
Created Nov 15, 2022
Question about preferred code conversion
View conversion.js
// Starting with an API returned data structure like this:
const Parameters = [
Name: "PASS",
Type: "SecureString",
Value: "cGFzc3dvcmQ=",
Version: 3,
LastModifiedDate: "2022-11-14T15:13:08.263Z",
ARN: "arn:aws:ssm:us-east-1:678000000000:parameter/PASS",
joemaller / curl-format.txt
Created Nov 8, 2022
Template for reporting connection times from curl connections. More here:
View curl-format.txt
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
time_total: %{time_total}\n
joemaller / harrassment-training-bot.js
Created Oct 6, 2022
bot for helping test online training. Kind of garbage, but maybe useful in the future.
View harrassment-training-bot.js
* For ADP's 2022 sexual harrassment training
cr = () => {
const next = $('')
if (next.length) {;
joemaller /
Created Sep 23, 2022
Case Conversion examples

Input: my name is bond

Name Sample
🐪 Camel case myNameIsBond
👨‍🏫 Pascal case MyNameIsBond
🐍 Snake case my_name_is_bond
👩‍🏫 Ada case My_Name_Is_Bond
Ⓜ️ Macro case MY_NAME_IS_BOND
🥙 Kebab case my-name-is-bond
joemaller /
Created Jan 23, 2018
Luxon Timestamps

Finding this took me longer than it should have, probably because I was impatiently looking for "timeststamp" instead of "milliseconds of the Unix epoch". For future searchers, Luxon uses the methods DateTime.fromMillis and DateTime.valueOf.

// Create a Luxon DateTime from a JS Unix timestamp
const ts = new Date().getTime();     // 1516717417146
const dt = DateTime.fromMillis(ts);  // { ts: 2018-01-23T09:23:37.146-05:00 ...
console.log(dt.valueOf());           // 1516717417146
joemaller / index.html
Last active Sep 9, 2022 — forked from d3noob/index.html
Add multiple markers in leaflet.js
View index.html
<!DOCTYPE html>
<title>Simple Leaflet Map</title>
<meta charset="utf-8" />
joemaller / Verizon FiOS - DNS
Created May 9, 2018
Nameservers for Verizon FiOS - North East US specific
View Verizon FiOS - DNS

Boston, MA:

  • -

New York, NY:

  • -

Newark, NJ: -

Philadelphia, PA:

joemaller /
Last active Jun 17, 2022
Get PHP child Class file paths from inherited parent class methods

Get PHP child Class file paths from inherited parent class methods

While refactoring some code into a reusable PHP Class I hit a brief roadblock where some code expected the [__FILE__ magic constant][file] file path. Since that value always refers to the specific file it's called from, it won't work from a separate Class file because the referenced path would be the parent instead of the child.

The full filepath of a child Class can be inferred from an inherited parent Class method by combining [get_class($this)][get_class] or [get_called_class()][get_called_class] with the [ReflectionClass::getFileName][getfilename] method like this:

// ParentClass.php
class ParentClass
joemaller /
Last active Feb 6, 2022
Out of deference to Prettier, I'm switching to filling empty attributes

Previously, for "cleaner HTML" I tended to prefer something like this:

$classes = ['cat', 'dog'];
$classAtt = empty($classes) ? "" : " class='" . implode($classes, ' ') . '"'; 
<div<$= $classAtt ?>>Text</div>

That string concatenation is just gross, but the HTML is "nicer"; the opening tag will either be or.

joemaller / resize safari.applescript
Last active Jan 18, 2022
AppleScript snippet to resize the front-most Safari window to a given size
View resize safari.applescript
tell application "Safari" to set the bounds of the front window to {0, 0, 1600, 1080}