Skip to content

Instantly share code, notes, and snippets.

View tdlm's full-sized avatar

Scott Weaver tdlm

View GitHub Profile
@tdlm
tdlm / Dev_Sync_Template.md
Last active December 14, 2022 23:07
Helper 'notes' command for making new notes for dev syncs, interviews and meetings using template Markdown files.
View Dev_Sync_Template.md

Dev Sync - {DATE}

Participants: Weaver

Discussion Topics

  • Previous Action Items
  • Announcements
  • Current Tickets
@tdlm
tdlm / Hookable.php
Created March 18, 2021 20:54
Hookable Plugins with singleton action
View Hookable.php
<?php
/**
* Trait Hookable
*/
trait Hookable
{
/**
* Add doc hooks.
*/
@tdlm
tdlm / composer.json
Created February 2, 2021 07:55
Convert a bunch of vCard (VCF files) to a CSV file output
View composer.json
{
"name": "scott/vcf-to-csv",
"require": {
"jeroendesloovere/vcard": "^1.7"
}
}
@tdlm
tdlm / fix-wordpress-permissions.sh
Last active June 10, 2020 00:06 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
View fix-wordpress-permissions.sh
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=${1:-.} # <-- wordpress root directory
@tdlm
tdlm / setup.sh
Last active March 27, 2020 17:22
New Mac Setup Script
View setup.sh
#!/usr/bin/env bash
# ____ __
# /'\_/`\ /\ _`\ /\ \__
# /\ \ __ ___ \ \,\L\_\ __\ \ ,_\ __ __ _____
# \ \ \__\ \ /'__`\ /'___\ \/_\__ \ /'__`\ \ \/ /\ \/\ \/\ '__`\
# \ \ \_/\ \/\ \L\.\_/\ \__/ /\ \L\ \/\ __/\ \ \_\ \ \_\ \ \ \L\ \
# \ \_\\ \_\ \__/.\_\ \____\ \ `\____\ \____\\ \__\\ \____/\ \ ,__/
# \/_/ \/_/\/__/\/_/\/____/ \/_____/\/____/ \/__/ \/___/ \ \ \/
# \ \_\
@tdlm
tdlm / CONNECTIVITY_CHECKER_README.md
Last active May 24, 2019 17:28
Connectivity checker bash script
View CONNECTIVITY_CHECKER_README.md

Connectivity Checker

Intermittently check to see if your Internet connection is up and running.

Installation

  1. Create and paste the code for connectivity_checker into a corresponding file in /usr/local/bin and make sure to chmod +x /usr/local/bin/connectivity_checker
  2. From your command line, type crontab -e
  3. Within the crontab editor, make a new line
  4. Enter */5 * * * * /usr/local/bin/connectivity_checker to check every 5 minutes
@tdlm
tdlm / how-i-work.md
Last active May 19, 2023 02:13
How I Work
View how-i-work.md

When I Work

I am in the Pacific time zone (UTC -8/-7). Typically, I work from 9:00am - 6pm after waking up at about 5:30am, hopefully with a brief walk around the block, and getting the kids started with their day. I try to take a lunch anywhere between 11:30am and 2pm. Sometimes I'll step away for a short sanity break. Other than that, I'm usually at my desk. At the very least, I have my phone with me.

All that being said, I try my best to stay mindful, wherever I am. When I'm at work, my priority is work. When I'm with family, however, work becomes a close second.

Where I Work

I work from my home office in Anaheim Hills, California.

@tdlm
tdlm / git.md
Created August 14, 2017 17:41
Git wizardry.
View git.md

Copy files from another branch into new branch

$ git checkout master
$ git checkout -b new_branch
$ git checkout old_branch -- path/to/filea.ext
$ git checkout old_branch -- path/to/folder/
@tdlm
tdlm / vim.md
Last active May 17, 2017 16:10
Vim Wizardry
View vim.md
Command Effect
V Visual line highlight.
C-V Visual block highlight.
C-z Suspend Vim and go go shell. Type fg to return to Vim session.
a Append mode.
A Go to end of line and go into insertion mode.
I Go to beginning of line and go into insertion mode.
R Replace mode. (backspace will undo any newly-typed characters!)
o Create a new line below and go into insertion mode.
View sum_without_highest_lowest.js
const sumArray = (a) => {
if ( typeof a == 'undefined' || !a || a.length < 2 ) { return 0; }
a.sort((a,b) => a - b).splice(0, 1)
a.splice(a.length - 1, 1);
if ( a.length < 3 ) { return 0; }
return a.reduce((a,b) => a+b);
};