Skip to content

Instantly share code, notes, and snippets.

View kbond's full-sized avatar

Kevin Bond kbond

View GitHub Profile
@kbond
kbond / ExampleTest.php
Last active March 16, 2023 11:44
Laravel Dusk in a non-laravel (Symfony) app
<?php
namespace App\Tests\Browser;
use App\Tests\HasDuskBrowser;
class ExampleTest extends \PHPUnit_Framework_TestCase
{
use HasDuskBrowser;
@kbond
kbond / GhostProxyBuilder.php
Last active January 21, 2023 16:49
Proxy Builder
<?php
/**
* @author Kevin Bond <kevinbond@gmail.com>
*
* @template T of object
* @extends ProxyBuilder<T>
*/
final class GhostProxyBuilder extends ProxyBuilder
{
@kbond
kbond / post.md
Last active October 6, 2022 12:18
Ubuntu LAMP Development Environment Setup

Install git:

sudo apt-get install git

Configure Git:

touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
git config --global user.name "Your Name"

git config --global user.email "Your Email"

@kbond
kbond / AppKernel.php
Last active March 6, 2020 19:10
JWT Authentication With Symfony Guard. POST username/password to /login to receive token, /api* requests require a valid token
<?php
// app/AppKernel.php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
public function registerBundles()
{
@kbond
kbond / index.php
Last active November 21, 2018 20:50
Laravel advanced migration examples
<?php
Schema::create('visits', function (Blueprint $table) {
$table->increments('id');
$table->string('url');
$table->json('data');
// non-nullable timestamps
$table->timestamp('created_at')->default(\DB::raw('CURRENT_TIMESTAMP'));
$table->timestamp('updated_at')->default(\DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
@kbond
kbond / ORMRepository.md
Last active July 6, 2017 15:09
ORMRepository trait
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Zenstruck\Porpaginas\Doctrine\ORMQueryIterateResult;
use Zenstruck\Porpaginas\Result;

trait ORMRepository
{
    /** @var EntityManager */
@kbond
kbond / phpenv.sh
Created November 1, 2016 20:32
Switch between PHP versions
if [ "$1" = "5" ]; then
sudo ln -sfn /usr/bin/php5.6 /etc/alternatives/php;
else
sudo ln -sfn /usr/bin/php7.0 /etc/alternatives/php;
fi
@kbond
kbond / build.xml
Created May 10, 2011 14:23
Symfony2 ant build script template
<?xml version="1.0" encoding="UTF-8" ?>
<project name="[PROJECT_NAME]" default="build" basedir=".">
<property environment="env"/>
<loadfile property="version" srcfile="${basedir}/VERSION"/>
<condition property="bat" value=".bat" else="">
<os family="windows" />
</condition>
<target name="test">
<delete dir="${basedir}/build"/>
Verifying that +zenstruck is my blockchain ID. https://onename.com/zenstruck
@kbond
kbond / VAGRANT.md
Last active January 2, 2016 00:58
Vagrant Setup

Setup host machine

  1. Ensure VirtualBox and Vagrant are installed.

  2. Install Puppet:

    $ wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb
    $ sudo dpkg -i puppetlabs-release-precise.deb
    $ sudo apt-get update

$ sudo apt-get install puppet