Skip to content

Instantly share code, notes, and snippets.

View mlebkowski's full-sized avatar
🤷‍♀️

Maciej Łebkowski mlebkowski

🤷‍♀️
View GitHub Profile
@mlebkowski
mlebkowski / AppKernel.php
Created April 15, 2016 08:43
Simple kernel to populate symfony cache for PHPStorm
<?php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Routing\RouteCollection;
class AppKernel extends Symfony\Component\HttpKernel\Kernel
{
public function registerBundles()
<?php
/**
* @inheritDoc
*/
protected function renderCustomSearchView(NodeTranslation $nodeTranslation, SearchViewTemplateInterface $page)
{
$view = $page->getSearchView();
$renderContext = new RenderContext([
@mlebkowski
mlebkowski / services.yml
Created April 1, 2016 10:22
Implementing strategy backend using nassau/registry-compiler
#
# Convert this configuration value to a container parameter: %foobar.api_strategy%
#
foobar:
api_strategy: readonly
services:
foobar.api.strategy:
class: 'FoobarBundle\Service\Api\StrategyApiService'
public: false
#!/bin/bash
set -ueo pipefail
TLS_HOME=${TLS_HOME:-"/etc/letsencrypt"}
NGINX_CERTS=${NGINX_CERTS:-"/home/puck/dotfiles/nginx/certs"}
cert_expires() {
declare cert=$1
#!/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;
#!/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
<?php
interface ContactDiffServiceInterface
{
public function generateDiffContact(ContactInterface $baseContact, ContactInterface $toDiff, $cleanup = true);
}
class ContactDiffService implements ContactDiffServiceInterface
{
public function __construct(IpressoFactoryInterface $factory, AttributeTypeFormatter $formatter);
#!/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 <(
#!/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'
#!/usr/bin/env bash
set -ueo pipefail
MYSQL_USER=${MYSQL_USER:-root}
main() {
local project=${1:-}
local suffix=${2:-"prod"}