View foreach-object-list.php
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 | |
// won't be incremented | |
$a = [ | |
0, | |
0, | |
]; | |
// !! will be incremented !! | |
$b = [ | |
(object)['count' => 0], |
View Gemfile
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
gem "byebug", "~> 11.1", :groups => [:development, :test] | |
gem "rss", "~> 0.2.9" |
View fts.rb
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 ruby | |
# v2021-12-24.1 | |
require 'sqlite3' | |
dbf = '/tmp/plan.db' | |
File.delete(dbf) if File.exists? dbf | |
db = SQLite3::Database.open dbf | |
db.results_as_hash = true | |
db.execute "CREATE VIRTUAL TABLE IF NOT EXISTS plan USING FTS5(contents,tokenize = porter)" | |
db.execute "INSERT INTO plan (contents) VALUES(?)", File.open(ARGV[0]).read |
View husky-utils.sh
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 | |
# Adds the current date (and an optional prefix) to the string to be logged | |
add_date() { | |
while IFS= read -r line; do | |
printf '%s %s\n' "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" "$1 $line"; | |
done | |
} | |
# If any dependencies have changed, install them in the background. |
View demo.php
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 | |
namespace SvanDragt\Test; | |
require_once __DIR__ . '/vendor/autoload.php'; | |
use phpQuery; | |
function do_parse() { | |
// INITIALIZE IT | |
// phpQuery::newDocumentHTML($markup); |
View index.php
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 | |
/** | |
* Front to the WordPress application. This file doesn't do anything, but loads | |
* wp-blog-header.php which tells WordPress to load the theme. | |
* | |
* @package WordPress | |
* | |
* DO NOT EDIT THIS FILE. | |
* | |
* phpcs:disable PSR1.Files.SideEffects |
View upgrade.sh
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
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
do_upgrade() { | |
VERSION_FILE=".bin/upgrade.version" | |
if [ ! -f $VERSION_FILE ]; then | |
touch $VERSION_FILE | |
fi |
View countdown.sh
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 | |
# v3 - 2020-05-28 | |
if [ $# -eq 0 ]; then | |
echo "countdown.sh <seconds> \"<message>\"" | |
exit 1 | |
fi | |
secs=$1 | |
msg=${2:-$1 seconds passed.} | |
while [ $secs -gt 0 ]; do | |
echo -ne "$secs\033[0K\r" |
View stream_zip.php
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 | |
// composer init; composer require maennchen/zipstream-php | |
error_reporting(-1); | |
require_once __DIR__ .'/vendor/autoload.php'; | |
function stream_zip( array $files, string $out_file ) { | |
$out = fopen( 'file://' . $out_file, 'w' ); | |
$options = new ZipStream\Option\Archive(); | |
$options->setOutputStream( $out ); |
View composer.json
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
{ | |
"repositories": [ | |
{ | |
"type": "vcs", | |
"url": "https://github.com/wp-shortcake/shortcake" | |
}, | |
], | |
"require": { | |
"oomphinc/composer-installers-extender": "^1.1", | |
"fusioneng/shortcake": "dev-master#0.7.4" |
NewerOlder