Skip to content

Instantly share code, notes, and snippets.

View moritzjacobs's full-sized avatar
sparking joy

Moritz Jacobs moritzjacobs

sparking joy
View GitHub Profile
@moritzjacobs
moritzjacobs / phpmaillog3.php
Last active September 4, 2017 09:04
phpmaillog v3
#!/usr/bin/php
<?php
/*
# phpmaillog
Save emails to your desktop instead of sending them in local dev environments
## Installation:
### For Mac OS X:
($ => {
/**
* jQuery.selectToggler
*
* replaces a <select><option>… structure with a simple toggle structure
*
* $("select.foobar").selectToggler(function(el){
* el.addClass("foobar-toggler");
* el.find("> *").addClass("foobar-toggles");
* })
@moritzjacobs
moritzjacobs / class.easy-admin-table.php
Created July 3, 2018 11:12
helper class for easier table creation in wordpress admin views
<?php
/**
* Simplified usage of tables in wordpress plugin admin views.
*
* @package EasyAdminTable
* @author Moritz Jacobs <mail@moritzjacobs.de>
* @license GPL-2.0+
* @link http://moritzjacobs.de
*/
/**
* JS utility function to sort an array of clothing sizes (["M", "S", "XL", "XXS"])
* by size and not alphabetically.
*
* Usage:
```
clothingSizesSort(["S", "M", "XL"]) // should === ["XXS", "S", "M", "XL")
```
@moritzjacobs
moritzjacobs / package.json
Created March 2, 2020 16:06
package.json before scriptlint
{
"name": "my-cool-project",
"version": "1.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"eslint": "eslint src",
"start-dev": "webpack-dev-server",
"build": "webpack"
},
@moritzjacobs
moritzjacobs / scriptlint.txt
Last active March 3, 2020 12:29
scriptlint-result #1
⧙։⧘ [warning] must contain a "start" script (mandatory-start)
⧙։⧘ [warning] must contain a "dev" script (mandatory-dev)
⧙։⧘ [warning] `test` script can't be the default script (no-default-test)
@moritzjacobs
moritzjacobs / package.json
Last active March 3, 2020 12:37
scriptlint changes: non-strict
{
"name": "my-cool-project",
"version": "1.0.0",
"scripts": {
"test": "npm run build && npm run eslint",
"eslint": "eslint src",
"start": "webpack-dev-server",
"dev": "npm run start",
"build": "webpack"
$ scriptlint
⧙։⧘ [✔️] ✨ All good
⧙։⧘ [warning] script name "eslint" should start with one of the allowed namespaces (uses-allowed-namespace)
⧙։⧘ [warning] scripts must be in alphabetic order (alphabetic-order)
⧙։⧘ [warning] Use of unix double ampersand (&&) in script 'test' is not allowed, consider using npm-run-all/run-s (no-unix-double-ampersand)
⧙։⧘ [warning] Use of unix double ampersand (&&) in script 'test' is not allowed, consider using npm-run-all/run-s (no-unix-double-ampersand)
⧙։⧘ [✔️] Fixed 2 issues!
// results in …
{
"name": "my-cool-project",
"version": "1.0.0",
"scripts": {
"build": "webpack",