Skip to content

Instantly share code, notes, and snippets.

View coderabbi's full-sized avatar

Yitz Willroth coderabbi

View GitHub Profile
@coderabbi
coderabbi / gist:79b9879b123f450521248886466f6a00
Last active January 7, 2017 08:11
processModelsMappedFromFormRequest()
Collection::macro('transpose', function () {
$items = array_map(function (...$items) {
return $items;
}, ...$this->values());
return new static($items);
});
public function store(Request $request)
{
@coderabbi
coderabbi / retry.php
Last active September 3, 2015 18:23
Retry
<?php
class RetriesExceededException extends \Exception {}
class Retry
{
const MAX_RETRIES = 5;
const BASE_RETRY_DELAY = 1000000;
@coderabbi
coderabbi / gist:cdfc0b59fe381f55aef8
Last active August 29, 2015 14:10
Peer Code Review
Let's start simple.
Add your name, contact info (twitter) and a line or two describing where you're holding and what you're looking to get out of a pairing in the comments below.
If you make a connection, come back and remove your comment.
Over the course of a week (max) pledge each other one hour of code review.
Throw some code in a gist or a repo, invite your partner and see what happens.
abstract class ValueObject
{
private function __construct(array $params)
{
foreach($params as $key => $value)
{
if (property_exists($this, $key))
{
$this->$key = $value;
class MyValueObject
{
/**
* @Assert\Length(min = 3)
* @Assert\NotBlank
*/
private $propertyOne;
@coderabbi
coderabbi / new_gist_file
Created November 17, 2013 13:29
Git Post-Checkout Hook: Composer Install
#!/bin/bash
#
# Allows us to read user input below, assigns stdin to keyboard
exec < /dev/tty
while true; do
read -p "Run Composer install? [Y/n]: " yn
case $yn in
[Yy]* ) composer install;;