Skip to content

Instantly share code, notes, and snippets.

View u01jmg3's full-sized avatar
🔷
Coding Hard

Jonathan Goode u01jmg3

🔷
Coding Hard
View GitHub Profile
@u01jmg3
u01jmg3 / how-to-setup-phpcs-phpcbf-and-phpmd.md
Last active December 20, 2020 16:44
PHP Codesniffer, Code Beautifier & Mess Detector Setup

Composer Installation

  • Install Composer - https://getcomposer.org/Composer-Setup.exe
    • ℹ️ You may need to enable OpenSSL in your PHP installation by going directly to ./wamp/bin/php/php-5.x.x/php.ini and enabling the OpenSSL extension
      • These instructions assume you have WAMP installed already in order to provide your technology stack
    • To install globally the necessary Composer packages paste this command into a terminal and hit Enter ↵
      • ℹ️ The openssl extension must be enabled within php.ini of the PHP build you are using with the command line
      • (Start → Run → Type: cmd to open a command prompt)
    • Add C:\Users\%USERNAME%\AppData\Roaming\Composer\vendor\bin to the PATH System Variable
  • Start → Run → control sysdm.cpl,,3 → Environment Variables
@u01jmg3
u01jmg3 / Now Playing.ahk
Created June 10, 2020 14:58
AutoHotkey - speak aloud the currently playing track 🗣
#Persistent
#SingleInstance, Force
#NoEnv
If ProcessExist("wmplayer.exe")
wmp := new RemoteWMP
!4:: ; Alt+4
SpeakAloudTrack(wmp)
Return
@u01jmg3
u01jmg3 / mp3tag.txt
Last active May 28, 2020 21:40
Mp3tag
// Tag → Filename
$replace($caps(%artist%),', ', & ,Ft,feat.,Vs,vs.) - ''$caps($replace($lower($replace(%title%,'',’)''),' (original mix)',,extended ,, mix, remix,' (',''' (','(','[',')',']',']''',']',' [mix]',,' [remix]',),''' [')
@u01jmg3
u01jmg3 / datatables.paging.js
Created April 27, 2020 13:34
DataTable Pager - Numbers with Ellipses - 1 ... 4 5 6 ... 50 Previous Next
$.fn.DataTable.ext.pager.numbersWithEllipses = function (page, pages) {
if (pages === 1) {
return [];
}
var numbers = [],
buttons = 3,
withEllipses = true;
var range = function (len, start) {
@u01jmg3
u01jmg3 / questions.txt
Last active April 17, 2020 19:25
Quiz Questions
GEOGRAPHY
1. Which US state has the longest coastline? (Alaska)
2. How many timezones are there in China? (1)
3. What is the capital of Switzerland? (Bern)
4. What is the largest island in the world? (Greenland)
5. Which country is the largest producer of coffee? (Brazil)
6. What is the national sport of Canada? (Lacrosse)
7. What country spans all four hemispheres? (Kiribati)
8. What is the most northerly capital city in the world? (Reykjavik)
9. What country has three capital cities? (South Africa)
@u01jmg3
u01jmg3 / .htaccess
Created October 12, 2016 09:46
Template Apache `.htaccess` file with common rewrite rules
##================================================
# Prevent directory listing.
##================================================
IndexIgnore *
##================================================
# Set Charset.
##================================================
AddDefaultCharset utf-8
@u01jmg3
u01jmg3 / string-differences.php
Created January 30, 2020 12:06
Highlight string differences using `<del>` and `<ins>`
<?php
/**
* Generate two arrays:
* Values array: a list of elements as they appear in the diff
* Mask array: 0: unchanged, -1: removed, 1: added
*
* @param string $from
* @param string $to
* @return array
@u01jmg3
u01jmg3 / move-files-up.bat
Last active November 2, 2019 15:08
Windows right-click option to enable files or folders to be moved up one-level from the folder they are located in
@echo off
setlocal enableextensions disabledelayedexpansion
if "%~1"=="" exit /b
:: Delete empty folders
for /f "delims=" %%d in ('dir /s /b /ad ^| sort /r') do rd "%%d"
set FOLDER="%*"
@u01jmg3
u01jmg3 / .gitconfig
Last active August 19, 2019 17:07
Sourcetree Custom Actions
[alias]
cordova = "!f(){ MESSAGE=\"Build assets for deployment\"; [ \"$(git log -1 HEAD --pretty=format:%s)\" != \"$MESSAGE\" ] && git allclean && cordova prepare --release && git add -A && git commit -m \"$MESSAGE\" && git push || echo \"Commit already present\"; }; f"
fetch-pr = "!f(){ git fetch origin refs/pull/$1/head:pr/$1; }; f"
cleanup = !git clean -df
quick-clean = !git checkout . & git cleanup
all-clean = !git reset --hard && git cleanup
swap-last = !git tag _invert && git reset --hard HEAD~2 && git cherry-pick _invert _invert~1 && git tag -d _invert
invert-index = !git commit -m tmp1 && git add -A && git commit -m tmp2 && git swap-last && git reset HEAD~1 && git reset HEAD~1 --soft
@u01jmg3
u01jmg3 / create-app-icons.bat
Last active June 1, 2019 09:19
ImageMagick + Pingo
@echo off
cls
echo Creating 51 app icons, please wait.
im-convert ../../src/assets/images/app-logo-no-gradient.png ^
( -clone 0 -resize 2048x1536 -background #1f3165 -gravity center -extent 2048x1536 -write ../../platforms/ios/Assess/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png ) ^
( -clone 0 -resize 2048x1536 -background #1f3165 -gravity center -extent 2048x1536 -write ../screen/ios/screen-ipad-landscape@2x.png ) ^
( -clone 0 -resize 1536x2048 -background #1f3165 -gravity center -extent 1536x2048 -write ../../platforms/ios/Assess/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png ) ^