I hereby claim:
- I am matt-allan on github.
- I am mattya (https://keybase.io/mattya) on keybase.
- I have a public key ASCD9RfpRxzyrRfF79o7vA-ANxS6WBJTb785HRo1NsZnIwo
To claim this, I am signing this object:
_composer_scripts() { | |
local cur="${COMP_WORDS[COMP_CWORD]}" | |
local scripts=$(composer run-script -l --no-ansi 2> /dev/null | awk '/^ +[a-z]+/ { print $1 }') | |
COMPREPLY=( $(compgen -W "${scripts}" -- ${cur}) ) | |
return 0 | |
} | |
complete -F _composer_scripts composer |
<?php | |
abstract class ServiceProvider implements DefinitionSource | |
{ | |
/** | |
* @return array | |
*/ | |
abstract protected function definitions(): array; | |
/** |
openapi: 3.0.0 | |
info: | |
version: 1.0.0 | |
title: Matt's Bicycle Shop API | |
servers: | |
- url: http://api.matts-bikes.dev/v1 | |
paths: | |
/work-orders: | |
post: | |
summary: Create a work order |
0.0.0.0 | |
root ./ | |
gzip | |
fastcgi / 127.0.0.1:9000 php { | |
env FOO bar | |
} | |
rewrite { | |
regexp .* | |
ext / | |
to /index.php?{query} |
localhost:8080 | |
fastcgi / 127.0.0.1:9000 php { | |
env FOO bar | |
} | |
rewrite { | |
regexp .* | |
ext / | |
to /index.php?{query} |
localhost:8080 | |
fastcgi / 127.0.0.1:9000 php { | |
env HTTP_AUTH_PASSWORD secret123 | |
} | |
rewrite { | |
regexp .* | |
ext / | |
to /index.php?{query} |
I hereby claim:
To claim this, I am signing this object:
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Context Bridge Example</title> | |
<link rel="stylesheet" type="text/css" href="./styles.css"> | |
</head> | |
<body> | |
<main class="app"> | |
<button onclick="window.app.setFullscreen(true)">Enter fullscreen</button> |
This is an example of sorting a Laravel collection by > 1 attribute with different sort directions. Unlike some of the other solutions mentioned in this thread it works with any type PHP can normally sort and doesn't require hashing.
That works because of how PHP's comparison functions work:
Array with fewer members is smaller, if key from operand 1 is not found in operand 2 then arrays are uncomparable, otherwise - compare value by value
The <=>
operator is PHP's combined comparison operator, or 'spaceship' operator. It makes writing custom sort functions very easy.
If you need to do a compound sort but every attribute is being sorted in the same direction, you can use sortBy
/sortByDesc
instead of writing your own sort function.
{ | |
// You can extend the same config file typescript uses to avoid drift | |
"extends": "./base.json", | |
// Accepts globs. Works just like TypeScript | |
"include": [ | |
"src/wiretypes/**" | |
], | |
"exclude": [ | |
"src/wiretypes/*.test.ts" | |
], |