Skip to content

Instantly share code, notes, and snippets.

View croensch's full-sized avatar
🤠
out there

croensch

🤠
out there
  • Hella Gutmann Solutions
  • Freiburg im Breisgau, Germany
View GitHub Profile
@croensch
croensch / all.php
Last active December 8, 2022 21:48
PHP haltig engine warnings to PHPStan levels
<?php
/**
* https://wiki.php.net/rfc/engine_warnings
*/
// old-Level: Message > new-Level | phpstan-level
#$o = null;
// Warning: Creating default object from empty value > Error: Attempt to assign property "p" on null | 2
#$o->p = 0;

XML Schema Best Practices for Databinding

empty elements

Most programming languages implement unitialized values as NULL, ZERO, random data, something special (JavaScript: undefined) or an empty string. In XML an element can be empty in two ways and in DOM the textContent property is an empty string for both.

Valid examples:

<TodoItem/>
@croensch
croensch / 20200210.txt
Last active March 10, 2020 00:37
amazon-linux-extras
0 ansible2 available \
[ =2.4.2 =2.4.6 =2.8 =stable ]
1 *emacs=latest enabled [ =25.3 ]
2 httpd_modules available [ =1.0 ]
3 memcached1.5 available \
[ =1.5.1 =1.5.16 =1.5.17 ]
4 *nginx1.12=latest enabled [ =1.12.2 ]
5 postgresql9.6 available [ =9.6.6 =9.6.8 ]
6 postgresql10 available [ =10 ]
7 *python3=latest enabled [ =3.6.2 ]

Anzeigen

Eine Route und Template show erstellen mit

  • Titel als <H/>
  • Inhalt als <div/>

Die ID soll übergeben (/show/1) und geladen (SELECT * FROM page WHERE id = 1) werden.

Speichern

@croensch
croensch / Dockerfile
Created January 30, 2019 08:25
uopz101
FROM amazonlinux:2
RUN amazon-linux-extras install epel
RUN amazon-linux-extras install php7.2=7.2.13
RUN yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm && \
yum install -y yum-utils && \
yum-config-manager --enable remi-safe
RUN yum install -y --enablerepo=remi-php72 php-mbstring php-pecl-libsodium
RUN yum install -y --enablerepo=remi-php72 php-pecl-uopz-5.1.0
@croensch
croensch / c.php
Last active January 24, 2018 21:14
<?php
$c = curl_init();
curl_setopt_array($c, array(
CURLOPT_URL => $argv[1],
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_VERBOSE => true
));
$r = curl_exec($c);
if (curl_errno($c)) {
die(curl_error($c));
@croensch
croensch / sonar-javascript-rules.md
Last active August 29, 2015 14:05
sonar-javascript rules

XPath rules

undefined

undefined should not be assigned

``(//initialiser|//assignmentExpression)//unaryExpression//IDENTIFIER[@tokenValue="undefined"]```

var x = undefined; // bad
var x; // ok
x = undefined; // bad
if (x === undefined) { // ok*
 undefined = x; // totally NOT ok ;)
@croensch
croensch / README.md
Last active August 29, 2015 14:04 — forked from gmarik/README.md

About

minimal example of using [phantomjs] with [qunit]

$ phantomjs run-qunit.js file://`pwd`/test.html
'waitFor()' finished in 200ms.
Tests completed in 21 milliseconds.
5 tests of 5 passed, 0 failed.

Installation

@croensch
croensch / map-1.2-to-2.0.md
Last active August 29, 2015 14:02
sonar-php-2.0 rules

legend

old-tool:old-rule

new-name

wishlist

php_codesniffer:ValidDefaultValueNotAtEnd

?