Skip to content

Instantly share code, notes, and snippets.

Jonny Barnes jonnybarnes

Block or report user

Report or block jonnybarnes

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
@jonnybarnes
jonnybarnes / conflict.php
Created Aug 6, 2019
Used in my PHP Traits post for BuildEmpire
View conflict.php
<?php
trait One
{
public function hello()
{
echo 'Hello One' . PHP_EOL;
}
public function bye()
@jonnybarnes
jonnybarnes / class.php
Created Aug 6, 2019
Used in my PHP Traits post for BuildEmpire
View class.php
<?php
namespace Foo;
class MyClass
{
use Bar;
}
@jonnybarnes
jonnybarnes / trait.php
Created Aug 6, 2019
Used in my PHP Traits post for BuildEmpire
View trait.php
<?php
namespace Foo;
trait Bar
{
public function baz(string $value): string
{
// modify $value in some way
return mb_strtoupper($value)
View standard-heredoc.php
<?php
$variable = <<<TOKEN
Some text
TOKEN;
View jsonexception.php
<?php
try {
json_decode('{invalid{json', false, 512, JSON_THROW_ON_ERROR);
} catch (\JSONException $exception) {
MyLogger::error($exception->getMessage());
}
View 73-heredoc.php
<?php
class Foo
{
public static function bar(bool $input)
{
if ($input === true) {
$variable = <<<TOKEN
Hello
World!
View 72-heredoc.php
<?php
class Foo
{
public static function bar(bool $input)
{
if ($input === true) {
$variable = <<<TOKEN
Hello
World!
@jonnybarnes
jonnybarnes / 72-heredoc.php
Last active Sep 11, 2018
Embeds for my PHP 7.3 BuildEmpire blog post
View 72-heredoc.php
<?php
// some class
// some method
// an if statement
$variable = <<<TOKEN
Hello
World!
TOKEN;
View Quill bookmarks bookmarklet
javascript:%28function%28%29%7B%20%20var%20t%3Btry%7Bt%3D%28%28window.getSelection%26%26window.getSelection%28%29%29%7C%7C%28document.getSelection%26%26document.getSelection%28%29%29%7C%7C%28document.selection%26%26document.selection.createRange%26%26document.selection.createRange%28%29.text%29%29%3B%7Dcatch%28e%29%7Bt%3D%22%22%3B%7D%3B%20%20window.location%3D%22https%3A%2F%2Fquill.p3k.io%2Fbookmark%3Furl%3D%22%2BencodeURIComponent%28window.location.href%29%2B%22%26content%3D%22%2BencodeURIComponent%28%28t%20%3D%3D%20%27%27%20%3F%20%27%27%20%3A%20%27%22%27%2Bt%2B%27%22%27%29%29%2B%22%26name%3D%22%2BencodeURIComponent%28document.title%29%2B%22%26token%3Dey...3w%22%3B%7D%29%28%29%3B
@jonnybarnes
jonnybarnes / readme.md
Created Aug 7, 2017
Firefox Nightly logo
View readme.md

I have a 128x128 .png of the new logo.

Here’s my ~/.local/share/applications/firefox-nightly.desktop:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Firefox Nightly
Comment=Browse the Internet (Nightly)
You can’t perform that action at this time.