Skip to content

Instantly share code, notes, and snippets.

View rvanlaak's full-sized avatar

Richard van Laak rvanlaak

  • Amsterdam, Netherlands
View GitHub Profile
@malarzm
malarzm / MemoryGuard.php
Last active March 26, 2024 21:18
PHPUnit's MemoryGuard
<?php
declare(strict_types=1);
namespace Answear\DevelopmentHelpers\PHPUnit;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestListenerDefaultImplementation;
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active June 1, 2024 22:47
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@lsloan
lsloan / Postman current timestamp for UTC as ISO 8601.md
Last active September 4, 2023 11:44
Postman current timestamp for UTC as ISO 8601

I wanted to know: How can I get the current timestamp for UTC in ISO 8601 format to appear in the body data of a Postman request?

After reading some of the Postman documentation and online comments, this is the solution (using Postman v5.0.1 for Chrome 58.0.3029.110 on macOS 10.12.5) I used:

  1. In the Builder, while editing a request, click the "Pre-request Script" heading below the URL field.

  2. In the editor field that appears, enter this single line of JavaScript:

    postman.setGlobalVariable('timestampUtcIso8601', (new Date()).toISOString());
@pjcdawkins
pjcdawkins / .gitlab-ci.yml
Last active June 12, 2020 15:45
GitLab - Platform.sh CI scripts
stages:
- review
- cleanup
variables:
# The Platform.sh project ID.
PF_PROJECT_ID: abcdefg123456
push-platformsh:
# This Docker image installs the Platform.sh CLI (and PHP, Git and SSH).
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active June 1, 2024 14:33
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@adamelso
adamelso / platform-sh-inactive-branch-removal.js
Created March 10, 2016 12:15
Remove inactive branch environments from Platform.sh
var deleteBranches = function () {
return $("ul[ng-show='environment.active_trail']")
.first()
.find("li.disabled > div > a")
.map(function (i, b) {
return b.text;
});
};
var filterDeleteBranchesByPrefix = function (prefix) {
@manigandham
manigandham / rich-text-html-editors.md
Last active May 3, 2024 19:37
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@chadrien
chadrien / README.md
Last active September 1, 2023 12:43
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
@kandran
kandran / README.md
Last active November 19, 2018 08:28
Use php-cs-fixer with phpstorm file watcher

Auto use php-cs-fixer at save with PHPStorm and file watcher

  1. Open settings ( ctrl + alt + s)
  2. Menu file watchers
  3. Import watchers.xml
  4. Change settings like path for php and php-cs-fixer
  5. Enjoy ! PSRize at save.

NB: File watchers are linked to a specific project, so we have to re-import them for each project. External tools have IDE scope but we couldn't run them automaticaly - we could set a key bind.

@iki
iki / README.md
Last active December 12, 2021 08:50 — forked from othiym23/npm-upgrade-bleeding.sh
Update global top level npm packages

Update global top level npm packages

Problem

npm update -g updates all global packages and their dependencies, see npm/npm#6247.

Solution

  1. Either use the shell script or windows batch here instead.