Skip to content

Instantly share code, notes, and snippets.

Maciej Łebkowski mlebkowski

Block or report user

Report or block mlebkowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
# Input is tab separated, UTF-8 with " quotes
printf '\xFF\xFE';
cat "$INPUT" | iconv -f UTF-8 -t UTF-16LE
View ContactDiffService.php
interface ContactDiffServiceInterface
public function generateDiffContact(ContactInterface $baseContact, ContactInterface $toDiff, $cleanup = true);
class ContactDiffService implements ContactDiffServiceInterface
public function __construct(IpressoFactoryInterface $factory, AttributeTypeFormatter $formatter);
# 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 <(
if [ ! -f ".idea/nutricia.iml" ]; then
echo 'Run this command from the root of your project (.idea/nutricia.iml not found)' >&2
exit 1;
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'
#!/usr/bin/env bash
set -ueo pipefail
main() {
local project=${1:-}
local suffix=${2:-"prod"}
mlebkowski / functional.php
Last active Aug 29, 2015
Functional PHP with a little OOP aid
View functional.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)
# 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 (
# Based on a modified script from here:
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
View facade.php
class PaymentsFacade extends Container
private $requiredKeys = [
View EmailNotifier.php
interface EmailNotifierInterface {
* Client was successfully charged for a project
* context: payment_history model (with access to project & invoice)
const NOTIFICATION_CHARGED = 'charged';
View payment-retry.php
$retry = [
"today" => 'failure-notification',
'+1 day' => 'none',
'+3 days' => 'failure-notification',
'+1 week' => 'failure-notification',
'+2 weeks' => 'failure-notification, suspend'
You can’t perform that action at this time.