Skip to content

Instantly share code, notes, and snippets.


Frankie Jarrett fjarrett

View GitHub Profile
peterlafferty / IntegrationTest.php
Last active Aug 30, 2019
example integration test in PHPUnit which starts the build in web server
View IntegrationTest.php
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;
use GuzzleHttp\Client;
class IntegrationTest extends TestCase
/** @var Process */
private static $process;
danielbachhuber / thrasher-v2.php
Created Jun 5, 2017
Thrash APCu until it can no longer allocate memory
View thrasher-v2.php
* Thrash APCu until it can no longer allocate memory
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
View return-value-5.2.php
function __return_value( $value ) {
return create_function( '', sprintf( 'return %s;', var_export( $value, true ) ) );
Jamesits /
Last active Apr 11, 2022
Install Caddy Server on Ubuntu with Systemd.
# Should work on all Debian based distros with systemd; tested on Ubuntu 16.04+.
# This will by default install all plugins; you can customize this behavior on line 6. Selecting too many plugins can cause issues when downloading.
# Run as root (or sudo before every line) please. Note this is not designed to be run automatically; I recommend executing this line by line.
apt install curl
curl | bash -s personal dns,docker,dyndns,hook.service,http.authz,http.awses,http.awslambda,http.cache,http.cgi,http.cors,http.datadog,http.expires,http.filemanager,http.filter,http.forwardproxy,http.geoip,http.git,http.gopkg,http.grpc,http.hugo,http.ipfilter,http.jekyll,http.jwt,http.locale,http.login,http.mailout,http.minify,http.nobots,http.prometheus,http.proxyprotocol,http.ratelimit,http.realip,http.reauth,http.restic,http.upload,http.webdav,net,tls.dns.auroradns,,tls.dns.cloudflare,tls.dns.cloudxns,tls.dns.digitalocean,tls.dns.dnsimple,tls.dns.dnsmadeeasy,tls.dns.dnspod,tls.dns.dyn,tls.
adamwathan /
Last active Jan 19, 2021
Troubleshooting Valet on macOS Sierra

Troubleshooting Valet on Sierra

Common Problems

Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart
jimmyrolando / Cors.php
Last active Oct 24, 2020
Cors/Preflight Middleware for Laravel 5.2
View Cors.php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\Response;
class Cors
fjarrett / unautop-func.php
Last active Apr 6, 2022
Inverse behavior to the wpautop() function found in WordPress
View unautop-func.php
* Replaces paragraph elements with double line-breaks.
* This is the inverse behavior of the wpautop() function
* found in WordPress which converts double line-breaks to
* paragraphs. Handy when you want to undo whatever it did.
* @see wpautop()
fjarrett / sample.html
Last active Jun 13, 2016
HTML Sample Page Content
View sample.html
<div id="top"></div>
<p>The purpose of this HTML is to help determine what default settings are with CSS and to make sure that all possible HTML Elements are included in this HTML so as to not miss any possible Elements when designing a site.</p>
<hr />
<h1 id="headings">Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
stelabouras / loadAssetToInstagram.m
Last active Mar 18, 2021
Loads a Camera Roll Asset to Instagram (works for both photos & videos)
View loadAssetToInstagram.m
- (void)loadCameraRollAssetToInstagram:(NSURL*)assetsLibraryURL andMessage:(NSString*)message
NSString *escapedString = [assetsLibraryURL.absoluteString urlencodedString];
NSString *escapedCaption = [message urlencodedString];
NSURL *instagramURL = [NSURL URLWithString:[NSString stringWithFormat:@"instagram://library?AssetPath=%@&InstagramCaption=%@", escapedString, escapedCaption]];
[[UIApplication sharedApplication] openURL:instagramURL];
jtsternberg / db.php
Last active Jul 21, 2022
Simplified WordPress DB drop-in replacement for persistent database connections
View db.php
* Simplified WordPress DB drop-in replacement for persistent database connections
* (If gets into core)
* Actual working version right now would look like:
* WordPress Trac Ticket {@link}