This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for repo in $(curl -s --header "PRIVATE-TOKEN: YOUR_PERSONAL_ACCESS_TOKEN" "https://gitlab.com/api/v4/projects/?simple=yes&private=true&owned=true&per_page=1000" | jq -r ".[].id"); | |
do curl -H "Content-Type: application/json" --header "PRIVATE-TOKEN: YOUR_PERSONAL_ACCESS_TOKEN" -X DELETE "https://gitlab.com/api/v4/projects/$repo"; | |
done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
pecl install xdebug | |
docker-php-ext-enable xdebug | |
echo -e "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so\n\ | |
xdebug.mode=coverage\n\ | |
xdebug.remote_enable=1\n\ | |
xdebug.remote_autostart=1\n\ | |
xdebug.remote_connect_back=0\n\ | |
xdebug.remote_port=9001\n\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from "prop-types"; | |
import styles from './${NAME}.module.css'; | |
#set($cssClass = ${StringUtils.removeAndHump(${NAME}, ".")}) | |
#set($cssClass = $cssClass.substring(0,1).toLowerCase() + $cssClass.substring(1)) | |
function ${NAME}(props) { | |
return ( | |
<div className={styles.${cssClass}}> | |
#[[$END$]]# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Support; | |
class GridPositionCalculator | |
{ | |
/** | |
* Given the sequential index of the element in a flattened list, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Support; | |
class PercentileRankCalculator | |
{ | |
/** | |
* Calculate percentile rank over a field in a collection of associative arrays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Support; | |
class JsonEncoder | |
{ | |
private const JSON_PRETTY_PRINT_INDENT = 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* I add this to html files generated with pandoc. | |
*/ | |
html { | |
font-size: 100%; | |
overflow-y: scroll; | |
-webkit-text-size-adjust: 100%; | |
-ms-text-size-adjust: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
changed_lines_threshold=4 | |
changed_lines=$(git diff --numstat --pretty="%H" HEAD^ HEAD | awk 'NF==3 {numlines+=$1+$2} END {printf("%d", numlines)}') | |
if [[ $changed_lines -gt $changed_lines_threshold ]]]; then | |
echo "ERROR: Source code changes detected after last command (${changed_lines} lines). Aborting."; | |
exit 1; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function quick_debug(string $message = '', array $params = []) | |
{ | |
$file = __DIR__ . '/debug-dev.log'; | |
$date = date('Y-m-d H:i:s.u'); | |
$params = array_map(function ($data) { | |
if (is_scalar($data)) { | |
return $data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Contracts\Support\Arrayable; | |
use Illuminate\Contracts\Support\Jsonable; | |
use JsonSerializable; | |
class AbstractDto extends ArrayableJsonableObject implements \ArrayAccess | |
{ | |
public function __construct(array $properties = []) | |
{ |