Problem: you want to set protected properties of an object, or a set of objects as efficiently and without much convention as possible.
Solution in 5.4 is the "Anonymous Proxy", see the by-anonymous-proxy.php file.
<?php | |
return PhpCsFixer\Config::create() | |
->setRules([ | |
'psr0' => false, | |
'@PSR2' => true, | |
'array_syntax' => ['syntax' => 'short'], | |
'phpdoc_indent' => true, | |
'cast_spaces' => ['space' => 'single'], | |
'binary_operator_spaces' => [], |
<?php | |
return Symfony\CS\Config\Config::create() | |
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) | |
->fixers([ | |
'short_array_syntax', | |
'ordered_use', | |
]) | |
; |
App = Ember.Application.create({ | |
customEvents: { | |
swipeLeft: 'swipeLeft', | |
swipeRight: 'swipeRight', | |
swipeLeftTwoFinger: 'swipeLeftTwoFinger', | |
swipeRightTwoFinger: 'swipeRightTwoFinger', | |
dragDown: 'dragDown', | |
dragUp: 'dragUp', | |
dragDownTwoFinger: 'dragDownTwoFinger', | |
dragUpTwoFinger: 'dragUpTwoFinger' |
#!/bin/bash | |
# Put this file at: .git/hooks/post-checkout | |
# and make it executable | |
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587 | |
PREV_COMMIT=$1 | |
POST_COMMIT=$2 | |
NOCOLOR='\e[0m' |
<?php | |
class OpenStruct extends ArrayObject | |
{ | |
public function __construct($input = array()) | |
{ | |
parent::__construct($input, static::ARRAY_AS_PROPS); | |
} | |
public function offsetSet($key, $value) | |
{ |
<?php | |
abstract class Struct implements \ArrayAccess | |
{ | |
function __construct($properties = array()) | |
{ | |
$this->init(); | |
foreach ($properties as $property => $value) { | |
$this->$property = $value; |
function fitProjection(projection, data, box, center) { | |
// get the bounding box for the data - might be more efficient approaches | |
var left = Infinity, | |
bottom = -Infinity, | |
right = -Infinity, | |
top = Infinity; | |
// reset projection | |
projection | |
.scale(1) | |
.translate([0, 0]); |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
# install rvm | |
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) | |
# put this at the end of ~/.bashrc and log out and in | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" | |
# install the latest ruby | |
rvm install 1.9.2 | |
# make it the default |