This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="coll" value="class $COLLECTION$ implements \Countable, \IteratorAggregate { private $$$INTERNAL_STORE$; public function __construct($ENCAPSULATED_TYPE$ ... $$$INTERNAL_STORE$) { $this->$INTERNAL_STORE$ = $$$INTERNAL_STORE$; } public function count(): int { return count($this->$INTERNAL_STORE$); } /** * @return \Traversable|$ENCAPSULATED_TYPE$[] */ public function getIterator(): \Traversable { foreach ($this->$INTERNAL_STORE$ as $$$ITEM_VAR$) { yield $$$ITEM_VAR$; } } }" description="Typed immutable collection" toReformat="true" toShortenFQNames="true"> | |
<variable name="COLLECTION" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="INTERNAL_STORE" expression="camelCase(COLLECTION)" defaultValue="" alwaysStopAt="false" /> | |
<variable name="ENCAPSU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function processOrder(Order $order): Invoice | |
{ | |
$invoiceA = $order->processOrderOnLegacyLogic(); | |
$invoiceB = $order->processOrderOnRefactoredLogic(); | |
if($invoiceA->getTotal() !== $invoiceB->getTotal()) { | |
$this->log->error( | |
'Invoice comparison failed.', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function flattenExceptionBacktrace(\Exception $exception) { | |
$traceProperty = (new \ReflectionClass('Exception'))->getProperty('trace'); | |
$traceProperty->setAccessible(true); | |
$flatten = function(&$value, $key) { | |
if ($value instanceof \Closure) { | |
$closureReflection = new \ReflectionFunction($value); | |
$value = sprintf( | |
'(Closure at %s:%s)', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DYNAMODB_USER=vagrant | |
sudo apt-get install openjdk-7-jre-headless -y | |
cd /home/${DYNAMODB_USER}/ | |
mkdir -p dynamodb | |
cd dynamodb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use ManDate\Mandate; | |
use ManDate\Rule\WeekdayRule; | |
use ManDate\Rule\DaytimeRule; | |
use ManDate\Rule\MorningRule; | |
$mandate = new Mandate(); | |
$mandate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
guiltmode=0 | |
browse=0 | |
push=0 | |
iconbeer="🍺" | |
phpunitconfig="app" | |
phpunitdir="src" | |
coveragelocation="./coverage/index.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name www; | |
root /usr/share/nginx/www; | |
index app.php; | |
try_files $uri $uri/ /app.php?$query_string; | |
location ~ ^/(app_dev|app)\.php$ { | |
include fastcgi_params; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param HTTPS off; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Mobile meta & links --> | |
<!-- Reference | |
Custom Icon and Image Creation Guidelines: | |
http://developer.apple.com/library/safari/#documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html | |
Configuring Web Applications: | |
http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/configuringwebapplications/configuringwebapplications.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# These are the original commands, courtesy of: | |
# http://www.ravelrumba.com/blog/watch-compile-less-command-line/ | |
# Requires watchr: https://github.com/mynyml/watchr | |
# watchr -e 'watch(".*\.less$") { |f| system("lessc #{f[0]} > #{f[0]}.css && echo \"#{f[0]} > #{f[0]}.css\" "}') } | |
# Requires inotify-tools: https://github.com/rvoicilas/inotify-tools | |
# while true;do N=`find -name "*.less" `;inotifywait -qe modify $N ;for f in $N;do lessc $f ${f%.*}.css;done;done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# These are the original commands, courtesy of: | |
# http://www.ravelrumba.com/blog/watch-compile-less-command-line/ | |
# Requires watchr: https://github.com/mynyml/watchr | |
# watchr -e 'watch(".*\.less$") { |f| system("lessc #{f[0]} > #{f[0]}.css && echo \"#{f[0]} > #{f[0]}.css\" "}') } | |
# Requires inotify-tools: https://github.com/rvoicilas/inotify-tools | |
# while true;do N=`find -name "*.less" `;inotifywait -qe modify $N ;for f in $N;do lessc $f ${f%.*}.css;done;done |
NewerOlder