Skip to content

Instantly share code, notes, and snippets.

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

Maciej Łebkowski mlebkowski

🤷‍♀️
View GitHub Profile
@mlebkowski
mlebkowski / functional.php
Last active August 29, 2015 14:25
Functional PHP with a little OOP aid
<?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)
{
@mlebkowski
mlebkowski / s3.sh
Last active August 29, 2015 14:20 — forked from chrismdp/s3.sh
# 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
<?php
class PaymentsFacade extends Container
{
private $requiredKeys = [
'factory.project',
'price-calculator',
'repository.plan',
'repository.coupon',
'service.authorize-card',
<?php
interface EmailNotifierInterface {
/**
* Client was successfully charged for a project
*
* context: payment_history model (with access to project & invoice)
*/
const NOTIFICATION_CHARGED = 'charged';
<?php
$retry = [
"today" => 'failure-notification',
'+1 day' => 'none',
'+3 days' => 'failure-notification',
'+1 week' => 'failure-notification',
'+2 weeks' => 'failure-notification, suspend'
];
?>
<?php
namespace Metricso\Fetcher\ObjectProcessor ;
use Generator ;
use Metricso\Model\Fb\AppUser ;
use Metricso\Model\Fb\FbPage ;
use Metricso\Model\Fb\FbPageFeedQuery ;
class PageProcessor extends AbstractObjectProcessor implements ObjectProcessorInterface, UsingAlternateTokensInterface {
private $queryFactory ;
private $tokenSource ;
<?php
class QueryDependent
{
/**
* @var Callable
*/
private $queryFactory;
@mlebkowski
mlebkowski / post-release
Last active August 29, 2015 14:15
dokku post-release hook for crontab jobs
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE="dokku/$APP"
CRONTABS_DIR=$DOKKU_ROOT/.crontab
CONFIG_FILE=$CRONTABS_DIR/$APP.conf
mkdir -p "$CRONTABS_DIR";
@mlebkowski
mlebkowski / goat.js
Created January 22, 2015 12:23
Codility challenge
function solution(N) {
// sorry, not really my kind of thing, but here’s a goat:
console.log("\n\
\n\
/) (\\ \n\
)\\.:::::::::./( \n\
\\( o o )/ \n\
'-./ / _.-'`-. \n\
( oo ) / _ \\ \n\

Keybase proof

I hereby claim:

  • I am mlebkowski on github.
  • I am puck (https://keybase.io/puck) on keybase.
  • I have a public key whose fingerprint is AFB4 769E 17CE 7A93 AB41 B313 DB1B 67F7 129A 7370

To claim this, I am signing this object: