Skip to content

Instantly share code, notes, and snippets.

View thecrypticace's full-sized avatar

Jordan Pittman thecrypticace

View GitHub Profile
<?php
header("Content-Type:text/plain");
/* Escaping Challenge: Make a PHP script that (Z:) generates JavaScript code
* that generates an HTML page containing a PHP script that (goto Z) */
/* The purpose of this challenge is to demonstrate how complicated escaping can
* get when you're trying to combine 4 different languages (PHP, JavaScript,
* HTML, and string literals). */
function js_string_escape($data)
@thecrypticace
thecrypticace / Terminal Output
Last active February 8, 2017 19:26
Elixir 6.0.0 RC2 Combine error
$ node -v
v5.11.0
$ npm -v
3.8.6
$ gulp
/Users/me/Code/project/node_modules/parse-filepath/index.js:8
throw new Error('parse-filepath expects a string.');
^

Keybase proof

I hereby claim:

  • I am thecrypticace on github.
  • I am thecrypticace (https://keybase.io/thecrypticace) on keybase.
  • I have a public key ASDCy4Hw5zzX0ThF5TzoFIAtbdyFB-79Wfk6cJ2pnCAGzgo

To claim this, I am signing this object:

<?php
$entries = json_decode(file_get_contents("whatever.json"), true);
$tokensPerEntry = array_map(function ($entry) {
return $entry["requirements"]["others"];
}, $entries);
$tokens = array_merge([], ...$tokensPerEntry);
@thecrypticace
thecrypticace / fix-yarn
Last active January 22, 2017 23:58
Fix yarn transitive dependency binaries
#!/usr/bin/env php
<?php
file_exists("node_modules/.bin") || mkdir("node_modules/.bin");
chdir("node_modules/.bin");
foreach (glob("../*/bin/*") as $file) {
if (! is_executable($file)) {
continue;
@thecrypticace
thecrypticace / InteractsWithExceptionHandling.php
Last active March 6, 2017 02:27
Enhanced version of exception handler replacement
<?php
namespace Tests\Concerns;
use Exception;
use Throwable;
use App\Exceptions\Handler;
use Illuminate\Contracts\Debug\ExceptionHandler;
trait InteractsWithExceptionHandling
<?php
class Combinations
{
public static function unique($values, $minLength = 1, $maxLength = null)
{
// $combinations is an array of [["a"], ["a"], … ["a", "b"], ["a", "b", "c"], …]
// The array may not be sorted. Each internal array IS sorted.
// Keys produced by the generator are sequential but shouldn't matter
@thecrypticace
thecrypticace / settings.json
Last active October 23, 2017 14:09
VSCode Integrated Terminal Customizations
{
"workbench.colorCustomizations": {
"terminalCursor.foreground": "#fee381",
"terminal.selectionBackground": "#cb392e",
"terminal.background": "#0d151b",
"terminal.foreground": "#ffffff",
"terminal.ansiBlack": "#3c444d",
"terminal.ansiBlue": "#266b85",
"terminal.ansiBrightBlack": "#515d68",
"terminal.ansiBrightBlue": "#329dcc",
@thecrypticace
thecrypticace / imap-fetch.php
Created March 8, 2018 00:08
Sample IMAP Code
<?php
use Fetch\Server;
// https://github.com/tedious/Fetch
$server = new Server("outlook.office365.com", 993);
$server->setAuthentication("[email protected]", "mypassword");
$server->setFlag("novalidate-cert");
$server->setParam("DISABLE_AUTHENTICATOR", ["PLAIN"]);
=== RUN TestNextToken
=== RUN TestNextToken/{,}
=== RUN TestNextToken/{a,}
=== RUN TestNextToken/{ab,c}
=== RUN TestNextToken/{1..10}
=== RUN TestNextToken/{1...10}
panic: runtime error: slice bounds out of range [recovered]
panic: runtime error: slice bounds out of range
goroutine 24 [running]: