Skip to content

Instantly share code, notes, and snippets.

View mtdowling's full-sized avatar

Michael Dowling mtdowling

View GitHub Profile
@mtdowling
mtdowling / can_json_decode.php
Created March 29, 2017 21:27
Check if a value can be json_decoded
<?php
function try_json_encode($data)
{
json_encode($data);
return (json_last_error() == JSON_ERROR_NONE);
}
function json_encode_type_check($data)
{
@mtdowling
mtdowling / ModuleGraph.java
Created April 10, 2019 16:21
Module Graph example
package com.example;
import java.io.File;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayDeque;