Skip to content

Instantly share code, notes, and snippets.

View phptek's full-sized avatar

Russ Michell phptek

View GitHub Profile
Add the following methods to your `Image` subclass to allow SVG uploads via `$has_one` `UploadField`'s and uploads via the Asset Admin.
Hat-tip to https://github.com/restruct/silverstripe-svg-images. All I've done is:
* Removed superfluous SVG template logic
* Called `isSVG()` from everywhere
* Added comments where appropriate
* Put all necessary YML config into one place
YML config:
@phptek
phptek / nfs.sh
Last active April 21, 2022 01:53
Setup NFS on a Mac F/S
#!/usr/bin/env bash
OS=`uname -s`
if [ $OS != "Darwin" ]; then
echo "This script is OSX-only. Please do not run it on any other Unix."
exit 1
fi
if [[ $EUID -eq 0 ]]; then
FROM alpine:3.14
MAINTAINER AKQA 2022 <Wel.Tech@akqa.com>
ENV DOCROOT="/var/www/html/"
WORKDIR $DOCROOT
RUN apk update && apk upgrade
COPY .aws/foo-cron/hourly/* /etc/periodic/hourly/
@phptek
phptek / preferences.txt
Last active March 29, 2021 03:05
VSCode settings
- Open recent file (Not workspace)
* https://github.com/Microsoft/vscode/issues/49629
- DISABLE: Opening a file in a different location to my current location, the file hierarchy navigation will automatically drop to there
- CHECK: How to debug Python in VSCode
* See: https://github.com/microsoft/ptvsd/blob/master/TROUBLESHOOTING.md
Extensions:
DotEnv
PHP Intellisense
@phptek
phptek / TUNEZ
Last active March 29, 2021 02:19
Susana Feat Espen Gulbrandsen: "Connection" (Myon & Shane 54 Monsterless Mix) http://www.di.fm/tracks/69386/vocaltrance
Karel: "Transit" http://www.di.fm/tracks/698255/classictrance
Pulser Feat Molly Bankcroft: "In Deep" http://www.di.fm/tracks/56820/vocaltrance
Three Drives: "Greece 2000" (g&m remix) http://www.di.fm/tracks/75438/classictrance
Ferry Corsten feat. Guru: "Junk": http://www.di.fm/tracks/87356/trance
Gods Kitchen Summer Trance CD2: http://www.di.fm/tracks/91421/classictrance
Push: "Tranzy State Of Mind": http://www.di.fm/tracks/29727/classictrance
Cygnus X: "The Orange Theme": http://www.di.fm/tracks/67438/classictrance
Dave Angel "Balance Selections 007" (Soundcloud)
How to configure phpStorm with EditorConfig and PHPMD:
-----------------------------------------------------
PHPMD:
------
phpmd (PHP Mess Detector) is a static analysis tool that will find issues in your code you never knew you had. Your code will still run, follow a few of phpmd's recommendations though and it will be better!
phpmd is already bundled and enabled in phpstorm, but in order to more easily manage versions and add custom rulesets, you should do the following:
@phptek
phptek / Docker.txt
Created October 7, 2019 02:55
Docker basics
Dockerfile Best Practice:
* Keep no. RUN directoves to a minimum:
- Reduces filesize of generated image
- Ensures that changes to the command, regenerates the image properly (viz Dockerfile caching)
- Each command creates a new layer which is itself a separate image
* Security:
- Each service should have a dedicated user+group to use, to minimuse "leakage" from hacks in one service into other services
- Check snyk.io for additional security best-practices
* Images share commonalities, so makes sense ot use the same Base OS as the O/S' required by services themselves
......SHORTCUT ALL THE THINGS! OR
"STUFF YOU REALLY NEVER THOUGHT YOU NEEDED TO KNOW"...
Scenario: You have multiple _separate_ instances of the same window open e.g. Firefox or Chrome
Use: "alt + ~" to switch between them
Scenario: You have typed a long command, (or a short one with a long filename) and you need to change something at the end or the beginning:
@phptek
phptek / pgp
Last active August 15, 2019 20:22
List of PGP tools:
Link to Wikipedia: https://en.wikipedia.org/wiki/Pretty_Good_Privacy#Digital_signatures
CLI:
* gpg2
* https://www.linuxbabe.com/ubuntu/install-veracrypt-ubuntu-16-04-16-10
GUI:
@phptek
phptek / newcraptop
Created August 13, 2019 20:24
Rough laptop specs
Laptop:
* Webcam
* Headphone jack NOT on RHS
* 8Gb DDR3/4 RAM
* Core i5/i7
* >= 250Gb SSD
* 13-14" screen
* ~1.2Kg (Lenovo is 2kg)
* Chiclet keyboard