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
View OnceTrait.php
Trait OnceTrait {
private $once = [];
protected function once($callback, ...$arguments)
$hash = $this->hashOnceMethod(func_get_args());
View deploy-to-hub-wercker.yml
- script:
name: import application slug
code: |-
herokuish slug import < $WERCKER_SOURCE_DIR/slug.tgz
- script:
name: re-create application user
code: |-
useradd -u $(stat -c %u /app) zabka
View str_startswith.php
function str_startswith($str, $needle) {
return 0 === strpos($str, $needle);
function str_startswith($str, $needle) {
return $needle === substr($str, 0, strlen($needle));
mlebkowski /
Last active May 6, 2016
Choose one of the parent directories to change to


Interactively choose one of the parent dirs to change to.

Requirements & Installation

  1. Install percol
  2. Setup your shell to load the up function at startup
  • In fish use funced up, paste contents, funcsave up
  • In bash paste it in .bashrc or any other file and source it from .bashrc
View update-heroku-db
set -euo pipefail
parse_dsn() {
declare dsn=$1 part=$2
php -r 'echo parse_url($_SERVER["argv"][1], constant("PHP_URL_" . strtoupper($_SERVER["argv"][2])));' -- "$dsn" $part
mlebkowski / AppKernel.php
Created Apr 15, 2016
Simple kernel to populate symfony cache for PHPStorm
View AppKernel.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()
View service.php
* @inheritDoc
protected function renderCustomSearchView(NodeTranslation $nodeTranslation, SearchViewTemplateInterface $page)
$view = $page->getSearchView();
$renderContext = new RenderContext([
mlebkowski / services.yml
Created Apr 1, 2016
Implementing strategy backend using nassau/registry-compiler
View services.yml
# Convert this configuration value to a container parameter: %foobar.api_strategy%
api_strategy: readonly
class: 'FoobarBundle\Service\Api\StrategyApiService'
public: false
set -ueo pipefail
cert_expires() {
declare cert=$1
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;
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;
You can’t perform that action at this time.