Skip to content

Instantly share code, notes, and snippets.

Mark Dain ancarda

Block or report user

Report or block ancarda

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View no-errors.php
// catch everything
set_error_handler(function (int $errno, string $errstr, string $errfile = 'unknown', int $errline = 0, array $errcontext = []) {
echo("<p>[#$errno] $errstr</p>\n");
View tests.php
public function providerPsr7Implementations(): array
$guzzle = \GuzzleHttp\Psr7\stream_for(static::TEST_STRING);
return [
[StringStream::class, new StringStream(static::TEST_STRING)],
[get_class($guzzle), $guzzle],
[\Nyholm\Psr7\Stream::class, \Nyholm\Psr7\Stream::create(static::TEST_STRING)],
# Start tmux if it's not already running
if [ -z $TMUX ]
# Try to attach to an existing session if possible.
tmux attach
# If `tmux attach` returns 1, tmux isn't running. Start it
if [ $? -eq 1 ]

PHP RFC: Remove mktime


This RFC proposes we remove the mktime function.

mktime has existed since PHP 4, and is mostly a shim around the POSIX mktime function. Since it's introduction in PHP, better constructions have emerged like the DateTime object.

The behavior of mktime is confusing and unintuitive. In particular, the behavior of nulls:

ancarda /
Last active Dec 29, 2018
WIP Flowchart for Netflix Bandersnatch (***SPOILERS***). Note that not all decisions are made available automatically. Sometimes you need to re-play a few times, or need to explore alternate options.
# Netflix Bandersnatch choices.
# WARNING: Major spoilers (duh!).
# Paste into and hit "Generate Graph" to see.
digraph G {
Bandersnatch [shape=box];
"Breakfast?" [shape=diamond];
Bandersnatch -> "Breakfast?";
ancarda /
Last active Dec 5, 2018
Maybe, Option, ADT

Rust vs. Haskell

Algebraic Data Types

Built In Type: Maybe

enum Option<T> {
ancarda / serious-document.xml
Created Dec 2, 2018
I saw some MathML for the first time and got so angry that each **character** has it's own XML, eg. `where` would be written `<mi>w</mi><mi>h</mi><mi>e</mi><mi>n</mi>`. As a lover of XML, I believe this abuse must end. Here is where that kind of thinking leads to.
View serious-document.xml
<?xml version="1.0" charset="UTF-8"?>
<SeriousDocument sb:xmlns="" Identifier="{5DAB3EB7-A21E-4F1D-8F14-1C7AFA2249AA}" DocumentNamespace="com.SeriousBusiness.PortableXMLDocumentFormats.SeriousDocumentExampleFiles.HelloWorldVersionv2.65-FINAL-SignedOff-2019">
<sb:DocumentModificationLogEntry Identifier="{D6581BC3-296B-4D4B-8647-CB41C08A333D}">
<sb:DocumentModificaitonAuthor Identifier="{33238F05-41C7-4B9A-B56D-6006C6F79EA7}">
<sb:DocumentAuthorNameSegmentCandidate Language="en-GB" IsPreferredTextWherePossible="YES" Description="Given Name at Birth" NameFromBirth="YES" NameInRelevantLegalJurisdiction="YES">Mark</sb:DocumentAuthorNameSegmentCandidate>
View divide-by-zero.hs
main = do
print $ 0 / 0 -- NaN
print $ 0 / 1 -- 0.0
print $ 1 / 0 -- Infinity
# Essential terminal programs
apt install -y sudo curl wget vim git sudo htop screenfetch tree nmap dos2unix pgcli xclip
# Essential GUI programs
apt install -y vim-gtk3 vlc terminator
# i3
apt install -y i3 i3blocks
# Programming Languages
View gist:b3eb8270a67d1064525e4980e9e35072
build-cores = 4
build-max-jobs = 4
binary-caches =
binary-cache-public-keys =
You can’t perform that action at this time.