Skip to content

Instantly share code, notes, and snippets.

View mfdj's full-sized avatar
calculating infinity

Mark Fox mfdj

calculating infinity
View GitHub Profile
@mfdj
mfdj / javascript-undefined.html
Last active June 20, 2021 22:12
In ES5 undefined is protected at the global level but it's not quite bulletproof
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"></head>
<!-- Normal script -->
<script>
// starting in ES5 window.undefined is read-only
undefined = 'NOT UNDEFINED'
console.log(undefined === window.undefined) // prove that we are scoped to window object (global object in node)
console.log(undefined !== 'NOT UNDEFINED')
@joerx
joerx / php-fpm-nginx-errorlog.md
Last active August 6, 2023 16:49
redirect php-fpm output to nginx's error log
  • php process is wrapped like this: PHP file -> php-fpm -> nginx
  • basically means disable all facilities that catch output from the script on it's way to nginx
  • standard error output will the end in Nginx's logging facility

On CentOS

  • make sure your script does not set error_log
  • edit /etc/php-fpm.conf, disable line error_log = /var/log/php-fpm/error.log
  • edit /etc/php-fpm.d/www.conf, disable line starting with php_admin_value[error_log] = ...
  • restart fpm: systemctl restart php-fpm
@jeroenvdgulik
jeroenvdgulik / Talklist.md
Last active December 17, 2023 19:04
My mostly incomplete list of memorable talks that should probably be required material

The list is now hosted on a repository so you can PR -> https://github.com/jeroenvdgulik/awesome-talks/blob/master/README.md

The list

@mikehwang
mikehwang / jq-profilejsonschema.md
Last active December 23, 2025 10:09
Use jq to profile the schema of a given JSON object or an array of JSONs objects

Profile JSON schema

Using jq is great for examining JSON objects. You can extend its functionality with custom methods. The following is useful to understand at a high level the structure of arbitrary JSONs which is useful when trying to understand new data sources.

Requires jq verison 1.5.

Profile an object

Add the following method to your ~/.jq:

@jmauerhan
jmauerhan / pre-commit.php
Last active July 13, 2018 22:48
A pre-commit hook written in php to fix code style and alert about phpmd rules
#!/usr/bin/php
<?php
require __DIR__ . '/../../vendor/autoload.php';
/**
* Dependencies:
* - Symfony Console Component: symfony/console
* - Symfony Process Component: symfony/process
* - PHP Mess Detector: phpmd/phpmd
sudo rm -rf /
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active July 21, 2026 02:42
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@rex
rex / favorite-libraries.md
Last active July 20, 2026 19:01
A list of my favorite libraries, grouped for sanity
@sarciszewski
sarciszewski / PasswordLock.php
Last active August 29, 2015 14:16
Bcrypt + AES
<?php
namespace Sarciszewski\Gists;
/**
* This is a proof of concept code! DO NOT USE THIS!
*/
class PasswordLock
{
const KEY = '4ff556f7b1db2dd95906c21a45ef00344abdb38934450263ee7a908facc05070';