Skip to content

Instantly share code, notes, and snippets.

View patrickallaert's full-sized avatar

Patrick Allaert patrickallaert

View GitHub Profile
@patrickallaert
patrickallaert / gist:9ebb69f3dba393e0c7f0f553ed16d8b7
Created June 22, 2021 17:02
Signatures/hashes for php-8.1.0alpha2
php-8.1.0alpha2.tar.bz2
SHA256 hash: d19be34a14f0472199cccb33b43addbec9a271c427c1db8c98544464fd8b95ee
PGP signature:
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE8faSI4+8FmblpczUGZ+d/vb/uv0FAmDSFqsACgkQGZ+d/vb/
uv0ZQQ//Z6y32sNPQppIQecOtFzcrBgTGZm7ShNLP9yTHJvvirTnzBgZsdS89imu
NPBxFJxuT8i1gijxEMDTVnzxgS3wLgY/l+Tic57b8OV1O2BMJzYTAPbOIQ129dl/
6eosBpAErRqb0d2xlplUFg817GwfvVkhm7KbqNLwRy9DfnacMn5zVQE5XwI7LOJt
CIc1Er0Koo48s57uEIfffMOiqUodoR9yV4FL5TXcqAbyvEIDk/htMEY6+X2IlfwF
@patrickallaert
patrickallaert / HOWTO.md
Last active September 16, 2020 08:42
Integrate Phan in PHPStom

HOWTO

  1. Install Phan in your project using Composer, it should create the script vendor/bin/phan, otherwise install it the way you want and hack the run-phan script.
  2. Install script run-phan (see at the bottom of this page) on your system (I decided to put it at /usr/local/bin/run-phan).
  3. In PHPStorm, go in Settings > Tools > External Tools, add a new tool and provide the parameters:
    • Program: /usr/local/bin/run-phan
    • Working directory: $ProjectFileDir$
    • Check "Open console for tool output"
    • Output filters: $FILE_PATH$:$LINE$
  4. You can now use it from Tools > External Tools > Phan (or assign it a shortcut)
@patrickallaert
patrickallaert / example.html
Created February 12, 2020 16:13
Example of image gallery
<section class="images">
<a href="/image/a">
<picture>
<source srcset="/thumbnail/a.webp" type="image/webp"/>
<source srcset="/thumbnail/a.jpg" type="image/jpeg"/>
<img alt="" src="/thumbnail/a.jpg"/>
</picture>
</a>
<a href="/image/b">
<picture>
Installed Packages
acl.x86_64 2.2.53-1.el8 @ubi-8-baseos
apr.x86_64 1.6.3-9.el8 @ubi-8-appstream
apr-util.x86_64 1.6.1-6.el8 @ubi-8-appstream
apr-util-bdb.x86_64 1.6.1-6.el8 @ubi-8-appstream
apr-util-openssl.x86_64 1.6.1-6.el8 @ubi-8-appstream
audit-libs.x86_64 3.0-0.10.20180831git0047a6c.el8 @System
basesystem.noarch 11-5.el8 @System
bash.x86_64 4.4.19-7.el8 @System
brotli.x86_64 1.0.6-1.el8 @System
@patrickallaert
patrickallaert / script.js
Created February 25, 2019 15:16
defer image loading
document.addEventListener("DOMContentLoaded", function() {
const srcDeferAttribute = "data-defer";
const srcBackingAttribute = "data-deferred";
document.querySelectorAll("*[" + srcDeferAttribute + "]").forEach(function(lazyImage) {
if (!lazyImage.complete) {
lazyImage.setAttribute(srcBackingAttribute, lazyImage.getAttribute("src"));
lazyImage.setAttribute("src", "data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=");
}
lazyImage.removeAttribute(srcDeferAttribute);
<?php
return [
[
"name" => "Princess Leia",
"account" => "Princess_Leia",
"tweets" => [],
],
[
"name" => "Luke Skywalker",
@patrickallaert
patrickallaert / Xsetup
Created November 2, 2017 08:54
SDDM black screen gentoo
# /usr/share/sddm/scripts/Xsetup
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --output eDP-1-1 --mode 2880x1620
#include <bsd/string.h>
int main() {
char error[100];
char test[10];
test[0] = '\0';
strlcpy(error, test, sizeof(error));
return 0;
<?php
if (!is_callable($callable)) {
throw new \InvalidArgumentException(
'The controller for URI "' . $request->getPathInfo() . '" is not callable. '.
$this->getControllerError($callable)
);
}
<?php
$distinct = "DISTINCT"; // or empty
$columns = "a, b, c"; // columns
$table = "thetable"; // table to retrieve content from
$delete = false; // Fetch records marked deleted
$conditions = ""; // Series of conditions
$orderCol = "a"; // Order by
$orderDir = "ASC"; // Order by ASC/DESC
$limit = ""; // Optional limit number