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 | |
interface EmailNotifierInterface { | |
/** | |
* Client was successfully charged for a project | |
* | |
* context: payment_history model (with access to project & invoice) | |
*/ | |
const NOTIFICATION_CHARGED = 'charged'; | |
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 | |
class PaymentsFacade extends Container | |
{ | |
private $requiredKeys = [ | |
'factory.project', | |
'price-calculator', | |
'repository.plan', | |
'repository.coupon', | |
'service.authorize-card', |
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
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
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 | |
// Node[] -> (map) -> NodeTranslation[] -> (map) -> Category[] -> slice | |
// Purely „functional” PHP: | |
$parents = array_slice(array_map(function (NodeTranslation $nt) | |
{ | |
return new Category($nt->getTitle(), $nt->getNode()->getId(), $nt->getSlug()); | |
}, array_map(function (Node $node) | |
{ |
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
#!/usr/bin/env bash | |
set -ueo pipefail | |
MYSQL_USER=${MYSQL_USER:-root} | |
main() { | |
local project=${1:-} | |
local suffix=${2:-"prod"} | |
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 | |
if [ ! -f ".idea/nutricia.iml" ]; then | |
echo 'Run this command from the root of your project (.idea/nutricia.iml not found)' >&2 | |
exit 1; | |
fi | |
echo 'nutricia.iml filter=phar' >> .git/info/attributes | |
# on disk, there is never a trailing slash | |
git config --global filter.phar.smudge 'sed s,[.]phar/,.phar,g' |
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 | |
# remove exited containers: | |
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v | |
# remove unused images: | |
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi | |
# remove unused volumes: | |
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <( |
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 | |
interface ContactDiffServiceInterface | |
{ | |
public function generateDiffContact(ContactInterface $baseContact, ContactInterface $toDiff, $cleanup = true); | |
} | |
class ContactDiffService implements ContactDiffServiceInterface | |
{ | |
public function __construct(IpressoFactoryInterface $factory, AttributeTypeFormatter $formatter); |
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 | |
# | |
# Input is tab separated, UTF-8 with " quotes | |
# | |
INPUT="${1:-/dev/stdin}" | |
printf '\xFF\xFE'; | |
cat "$INPUT" | iconv -f UTF-8 -t UTF-16LE |
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 | |
if [ -z "$AWS_ACCESS_KEY_ID" -o -z "$AWS_SECRET_ACCESS_KEY" ]; then | |
echo 'Please define AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY' >&2 | |
exit 127; | |
fi | |
if [ -z "$BUILDER_APP_ID" -o -z "$BUILDER_STACK_ID" ]; then | |
echo 'Please define the application and stack for builder using BUILDER_APP_ID and BUILDER_STACK_ID' >&2 | |
exit 127; |