Skip to content

Instantly share code, notes, and snippets.

@cwhite92
cwhite92 / fqcn_from_path.php
Last active April 19, 2024 18:25
Get the FQCN from a PHP file specified by file path
<?php
public static function fqcnFromPath(string $path): string
{
$namespace = $class = $buffer = '';
$handle = fopen($path, 'r');
while (!feof($handle)) {
$buffer .= fread($handle, 512);
@Aha00a
Aha00a / jquery-release-notes.md
Last active April 18, 2024 08:48 — forked from arcdev/jquery-release-notes.md
jQuery Release Notes
@Nek-
Nek- / output_when_pressing_a.txt
Last active August 29, 2023 14:16
Windows PHP FFI handle creation
********You pressed A
@bradwilson
bradwilson / settings.json
Last active April 16, 2024 16:14
Ubuntu color scheme for Windows Terminal
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions": [
{
"command": "copy",
"keys": "ctrl+shift+c"
},
{
"command": "paste",
@jakub-g
jakub-g / async-defer-module.md
Last active July 23, 2024 21:22
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@rgl
rgl / wait_for_http_json_response.sh
Created August 25, 2016 07:43
Wait for an HTTP endpoint to return a given JSON property value with Bash, curl and jq
bash -c 'while [[ "$(curl -s localhost:9000/api/system/status | jq --raw-output ''.status'')" != "UP" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/f90ff293d56dbb0a1e0f7e7e89a81f42
@Petah
Petah / DbMigrate.php
Created July 4, 2016 07:56
Simple Migrate
<?php
namespace MyProject\Cli\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class DbMigrate extends \Symfony\Component\Console\Command\Command
{
@tronsha
tronsha / installphp7.sh
Last active October 13, 2023 00:13
Install PHP7 to Ubuntu
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev make
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
@DavidWells
DavidWells / reset.css
Last active July 27, 2024 15:56 — forked from karbassi/reset.css
CSS reset. Follow me on the twitters for more tips: https://twitter.com/davidwells
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@misiek08
misiek08 / gist:7988b3b9a9911e35d0b3
Created August 10, 2014 11:02
PHP class for parsing HTTP multipart/form-data request body
<?php
class HttpMultipartParser
{
public function parse_multipart($stream, $boundary = null)
{
$return = array('variables' => array(), 'files' => array());
$partInfo = null;