Skip to content

Instantly share code, notes, and snippets.

View jwpage's full-sized avatar

Johnson Page jwpage

View GitHub Profile
@mattias-persson
mattias-persson / .phpcsfixer
Last active September 7, 2020 04:30
StyleCI Laravel Preset config for PhpCsFixer
<?php
return PhpCsFixer\Config::create()
->setRules([
'psr0' => false,
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'phpdoc_indent' => true,
'cast_spaces' => ['space' => 'single'],
'binary_operator_spaces' => [],
@jwage
jwage / .php_cs
Last active May 3, 2023 06:42
php-cs-fixer git pre commit hook
<?php
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'short_array_syntax',
'ordered_use',
])
;
@manufaktor
manufaktor / application.js
Last active December 23, 2015 08:19
Custom events with ember.js and hammer.js
App = Ember.Application.create({
customEvents: {
swipeLeft: 'swipeLeft',
swipeRight: 'swipeRight',
swipeLeftTwoFinger: 'swipeLeftTwoFinger',
swipeRightTwoFinger: 'swipeRightTwoFinger',
dragDown: 'dragDown',
dragUp: 'dragUp',
dragDownTwoFinger: 'dragDownTwoFinger',
dragUpTwoFinger: 'dragUpTwoFinger'
@lyrixx
lyrixx / post-checkout
Created June 26, 2013 13:37
Git post checkout
#!/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'
@ziadoz
ziadoz / OpenStruct.php
Last active August 2, 2019 10:35
OpenStruct and Struct in PHP
<?php
class OpenStruct extends ArrayObject
{
public function __construct($input = array())
{
parent::__construct($input, static::ARRAY_AS_PROPS);
}
public function offsetSet($key, $value)
{
@CHH
CHH / struct.php
Last active December 10, 2015 20:59
A simple struct class for PHP.
<?php
abstract class Struct implements \ArrayAccess
{
function __construct($properties = array())
{
$this->init();
foreach ($properties as $property => $value) {
$this->$property = $value;
@ralphschindler
ralphschindler / README.md
Last active October 21, 2017 12:55
Anonymous Proxy Pattern (Ralph Schindler)

README

Problem & Solution

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.

@nrabinowitz
nrabinowitz / fitProjection.js
Created February 7, 2012 00:46
D3 function for fitting a projection to geodata
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]);
@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
# 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