Skip to content

Instantly share code, notes, and snippets.

View coderabbi's full-sized avatar

Yitz Willroth coderabbi

View GitHub Profile
@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;;
class MyValueObject
{
/**
* @Assert\Length(min = 3)
* @Assert\NotBlank
*/
private $propertyOne;
abstract class ValueObject
{
private function __construct(array $params)
{
foreach($params as $key => $value)
{
if (property_exists($this, $key))
{
$this->$key = $value;
@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.
@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: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)
{
Let's say you have this:
class SomeClass
{
// users are encouraged to extend and set to true to enable magical powers...
protected $someQuality = false;
public function isSomeQuality()
{
return $this->someQuality;

Keybase proof

I hereby claim:

  • I am coderabbi on github.
  • I am coderabbi (https://keybase.io/coderabbi) on keybase.
  • I have a public key whose fingerprint is 809F DF04 E9BF 1742 D4A6 5E24 8CEA 6959 FAC8 E8A7

To claim this, I am signing this object:

@coderabbi
coderabbi / bira.zsh
Created March 7, 2017 21:02
Updated Bira OMZ THeme
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
local user_symbol='#'
else
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local user_symbol='$'
fi
@coderabbi
coderabbi / .env
Last active June 25, 2017 10:37
Laravel Debugbar .env Conversion
DEBUGBAR_STORAGE_ENABLED=true
DEBUGBAR_STORAGE_DRIVER='file'
DEBUGBAR_STORAGE_PATH='storage/debugbar'
DEBUGBAR_STORAGE_CONNECTION=null
DEBUGBAR_INCLUDE_VENDORS=true
DEBUGBAR_CAPTURE_AJAX=true
DEBUGBAR_CLOCKWORK=false
DEBUGBAR_COLLECTOR_PHPINFO=true
DEBUGBAR_COLLECTOR_MESSAGES=true
DEBUGBAR_COLLECTOR_TIME=true