Skip to content

Instantly share code, notes, and snippets.

View alister's full-sized avatar
🏠
Working from home

Alister Bulman alister

🏠
Working from home
View GitHub Profile
@alister
alister / worktree-publish-to-gh-pages.md
Created August 15, 2020 11:46 — forked from ErickPetru/worktree-publish-to-gh-pages.md
Publishing a `dist` folder from `master` branch using **worktree** feature to `gh-pages` branch.

Setup

First of all, you need to have a gh-pages. If you don't have, create:

git branch gh-pages

This makes a branch based on the master HEAD. It would be okay but the files and the git history of master branch are not meaningful on gh-pages branch.

@alister
alister / ComicSansMSEverywhere.Bookmarklet.js
Last active March 13, 2020 12:32
Everything's more fun in these difficult times with Comic Sans....
javascript: var all = document.getElementsByTagName('*'); for (var i = 0, n = all.length; i < n; i++) { all[i].style.fontFamily = '"Comic Sans MS", "Chalkboard"';} void 0;
@alister
alister / .localrc
Created September 7, 2019 12:58
~/.localrc for zsh (on nas/linux)
SPACESHIP_PROMPT_ORDER=(time user dir host git php venv exec_time line_sep jobs exit_code char)
SPACESHIP_TIME_SHOW=false
SPACESHIP_USER_SHOW=needed
SPACESHIP_HOST_SHOW_FULL=false
SPACESHIP_EXIT_CODE_SHOW=true
@alister
alister / findPhpUnitXml.php
Created September 7, 2019 12:56
Find phpunit.xml* files, not in specific sub-dirs, esp not vendors/
<?php
use Symfony\Component\Finder\Finder;
require 'vendor/autoload.php';
$excludeDirs = [
'assets',
'bin',
'bower_components',
@alister
alister / bootstrap_test.php
Created September 19, 2018 21:46
Speeding up your tests, and also your code coverage!
<?php declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
if (extension_loaded('xdebug') &&
version_compare('2.6.0', phpversion('xdebug'), '<=')) {
xdebug_set_filter(
XDEBUG_FILTER_CODE_COVERAGE,
XDEBUG_PATH_WHITELIST,
[dirname( __DIR__ ) . '/src']
);
class TwigExtension extends \Twig_Extension
{
// ....
public function getFunctions()
{
return array(
new \Twig_SimpleFunction(
'tombstone',
array($this, 'twigTombstone'),
@alister
alister / FacebookConnectController.php
Last active October 19, 2017 15:05 — forked from rwitchell/FacebookConnectController.php
oauth2-client-bundle install example
<?php
namespace Comp\AppBundle\Controller;
use Comp\AppBundle\Entity\User;
use Comp\AppBundle\Form\FacebookRegistrationType;
use League\OAuth2\Client\Provider\FacebookUser;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
<?php
use AppBundle\SncRedis\ClientsListPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(/* listing bundles used in the app... */);
@alister
alister / .travis.yml
Created August 29, 2017 10:08
PHP-in-London awesome link checker
language: ruby
rvm:
- 2.2
before_script:
- gem install awesome_bot
script:
- awesome_bot --white-list example.com,github.com,travis-ci.org --set-timeout 5 --allow-timeout *.md
notifications:
email: false
@alister
alister / app.php
Last active December 10, 2018 12:47
Sample use of Tombstones
<?php
// ... other code - but NOT requireing 'vendor/autoload.php'
define('SRC_ROOT', __DIR__.'/../src');
define('TOMBSTONE_LOG', dirname(__DIR__)."/var/logs/tombstones.log");
use \Scheb\Tombstone\Tracing\TraceProvider;
use \Scheb\Tombstone\GraveyardProvider;
use \Scheb\Tombstone\Handler\StreamHandler;
if (!function_exists('tombstone')) {
/**