View xmlencode.php
<?php
/**
* Converts UTF-8 to XML-safe HTML entities: Изложение => &#1048;&#1079;&#1083;&#1086;&#1078;&#1077;&#1085;&#1080;&#1077;
*/
function xmlencode($string) {
$string = (string) $string;
// Replace < and ' and & etc.
$string = htmlspecialchars($string, ENT_XML1 | ENT_QUOTES);
View ing-creditcard-export.js
javascript: (function(f, a) {
f = new Blob(['"Datum","Naam / Omschrijving","Bedrag (EUR)","Af Bij"\n', [].map.call(document.querySelectorAll('#dscardsdetailsandtransactions tr.riaf-datatable-contents'), tr => ([
tr.querySelector('td.riaf-datatable-column-date').textContent.trim(),
tr.querySelector('td.riaf-datatable-column-date + td').textContent.trim(),
tr.querySelector('td.riaf-datatable-column-amount').textContent.trim(),
tr.querySelector('.riaf-datatable-icon-crdb-cr') ? 'Bij' : 'Af',
]).map(col => '"' + col.replace(/"/g, '""') + '"').join(',')).join('\n')], {type: 'text/plain'});
a = document.createElement('a');
a.download = 'trans.csv';
a.href = URL.createObjectURL(f);
View inc.explorer.php
<?php
$utcStart = microtime(true);
// Last modified timestamp
defined('TIMESTAMP') or define('TIMESTAMP', 'D d-M-Y H:i');
// Permissions
defined('ENABLE_DOWNLOAD') or define('ENABLE_DOWNLOAD', false);
defined('ENABLE_SOURCE') or define('ENABLE_SOURCE', false);
View SendUserInvitationJob.php
<?php
class SendUserInvitationJob {
protected $user;
protected $tests;
function __construct(User $user, array $tests) {
$this->user = $user;
$this->tests = $tests;
}
View behat.sh
# all at once:
vendor/bin/behat
# per feature:
find features/ -type f -name *.feature | xargs -n 1 vendor/bin/behat
View query.sql
-- SELECT
SELECT *
FROM orders O
WHERE 5 <= ANY(SELECT amount FROM order_lines WHERE order_id = O.id);
SELECT *
FROM orders O
WHERE id IN (SELECT order_id FROM order_lines WHERE amount >= 5);
View laravel.txt
ClientController (page callback)
- Annotations
- @Get/@Post - URI
- @Middleware - auth
- AuthServiceProvider - auth definition
- UserPolicy - auth callbacks
User model (entity type)
- Shared logic
- Authenticable
View keepalive.sh
script=$1
echo $script
while [ true ]; do
DT=$(date +"%Y%m%d_%H%M%S")
FILE="/tmp/keepalive-$DT.log"
echo $FILE
echo
touch $FILE
View ethrly-server.js
// console.log(process.argv);
var port = parseInt(process.argv[2]);
if ( !port || isNaN(port) ) {
console.log('\nPort arg must be int.\n\n');
process.exit();
}
var status = [0, 0, 0, 0, 0, 0, 0, 0];
View mailtodisk.php
<?php
// sendmail_path="C:\XAMPP\php\php.exe C:\WWW\mailtodisk.php \"C:\XAMPP\mailoutput\__TIME__-__RAND__-__SUBJECT__.eml\""
// sendmail_path = "/usr/bin/php /var/www/mailtodisk.php \"/var/www/mailoutput/__TIME__-__RAND__-__SUBJECT__.eml\""
// file_put_contents(__DIR__ . '/mailtodisk.log', print_r($_SERVER, 1));
// Destination folder/filename is required
$destination = @$_SERVER['argv'][1];
if (!$destination) {