Skip to content

Instantly share code, notes, and snippets.

View tyler-sommer's full-sized avatar
🖖
Working remote

Tyler Sommer tyler-sommer

🖖
Working remote
View GitHub Profile
@tyler-sommer
tyler-sommer / call.versus.reflection.php
Created April 2, 2012 22:32
__call versus reflection
<?php
/**
* A Simple Operation Benchmark Class
*
* @author Tyler Sommer
*/
class Benchmark {
protected $_length;
<?php
use Doctrine\ORM\Mapping as ORM,
Doctrine\Common\Collections\ArrayCollection;
/**
* File Entity
*
* @ORM\Entity
* @ORM\Table(name="files")
@tyler-sommer
tyler-sommer / gist:5165830
Last active March 23, 2018 17:15
example procedural cli-config.php with multiple entity managers
<?php
require_once '../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\ORM', realpath(__DIR__ . '/../../lib'));
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', realpath(__DIR__ . '/../../lib/vendor/doctrine-dbal/lib'));
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Common', realpath(__DIR__ . '/../../lib/vendor/doctrine-common/lib'));
$classLoader->register();
@tyler-sommer
tyler-sommer / _area_subnav.html.twig
Created March 21, 2013 23:05
This abuse of the twig templating engine can be used to generate menus given a fairly nice declaration syntax. Currently, it will generate a semi customized bootstrap menu
{% block subnav %}
{# This is how you declare a menu #}
{% include '::subnav.html.twig' with { pages: [
{ name: 'Manage', dropdown: [
{ route: 'customers', name: 'Customers' },
{ route: 'orders', name: 'Orders' },
{ route: 'chargebacks', name:'Chargebacks', role: 'ROLE_ADMIN' }
] },
@tyler-sommer
tyler-sommer / Benchmark.php
Last active April 5, 2020 18:51
Benchmark between SplFixedArray and regular PHP arrays with 10,000 very small elements.
<?php
/**
* A Simple Operation Benchmark Class
*
* @author Tyler Sommer
* @license WTFPL
*/
class Benchmark {
protected $_length;
@tyler-sommer
tyler-sommer / SerializableCallable.php
Last active September 9, 2015 04:26
Adding closures to compiled symfony 2 containers
<?php
/**
* Serializable Closure
*
* Allows the serialization of a closure, specifically a Closure, for storage
*/
class SerializableCallable implements \Serializable
{
/**
@tyler-sommer
tyler-sommer / fix.rb
Created October 17, 2014 17:52
Fix broken gitlab hooks in your project repositories
Dir.glob('/home/git/repositories/**/*.git') do |item|
hook = "#{item}/hooks"
if not File.symlink?(hook)
puts "Updating #{hook}"
File.rename(hook, "#{hook}.old")
File.symlink("/home/git/gitlab-shell/hooks", hook)
end
end
{
"host_groups": [
{
"name": "master",
"components": [
{
"name": "NAMENODE"
},
{
"name": "DATANODE"
@tyler-sommer
tyler-sommer / dashboard.html.twig
Created February 15, 2017 03:27
Example go-stickgen working with squircy2
{% extends 'layout.html.twig' %}
{% block content %}
<div class="row">
<div class="col-md-8">
<h4>Dashboard</h4>
</div>
</div>
<div class="row">
<div class="col-md-12">

Keybase proof

I hereby claim:

  • I am tyler-sommer on github.
  • I am veonik (https://keybase.io/veonik) on keybase.
  • I have a public key ASDyv6_Y54xyAAFhCsGVJE3g0wzUWQSj21v5oNioNDp81Qo

To claim this, I am signing this object: