Skip to content

Instantly share code, notes, and snippets.

View itsliamjones's full-sized avatar

Liam Jones itsliamjones

View GitHub Profile
@itsliamjones
itsliamjones / Configuration.php
Created January 16, 2019 09:04 — forked from xphere/Configuration.php
Recursive symfony/configuration
<?php
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* Helper function to create recursive nodes
*/
function recursiveNode(string $name, callable $callback)
@itsliamjones
itsliamjones / generator.php
Created September 4, 2018 14:08 — forked from tawfekov/generator.php
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@itsliamjones
itsliamjones / mysql-docker.sh
Created August 9, 2018 10:51 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@itsliamjones
itsliamjones / ruleset.xml
Created December 1, 2016 12:20 — forked from gsherwood/ruleset.xml
PSR2 with tabs instead of spaces
<?xml version="1.0"?>
<ruleset name="MyStandard">
<description>PSR2 with tabs instead of spaces.</description>
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
@itsliamjones
itsliamjones / .bowerrc
Created July 3, 2016 16:14 — forked from curiouslychase/.bowerrc
Gist for example bower project blog post.
{
"directory": "src/_lib",
"json": "bower.json"
}
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.