Skip to content

Instantly share code, notes, and snippets.

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

Maciej Łebkowski mlebkowski

🤷‍♀️
View GitHub Profile
<?php
header('Content-type: text/plain; charset=UTF-8');
$config = array(
'emails' => ['[email protected]'],
'subject' => "Nowe zgloszenie Energia",
'fields' => array (
'name' => array ('label' => 'Imię i nazwisko'),
'email' => array ('label' => 'Adres e-mail'),
'phone' => array ('label' => 'Telefon'),
@mlebkowski
mlebkowski / SortableInterface.php
Created July 21, 2014 08:45
SortableInterface
<?php
interface SortableInterface {
public function getSortValues();
}
class A implements SortableInterface {
private $order, $price, $id;
public function __construct($price, $id, $order) {
$this->id = $id;
# /etc/apache2/extra/httpd-vhosts.conf
<Directory /Volumes/Dev>
Require all granted
AllowOverride All
</Directory>
<VirtualHost *:80>
ServerName dev
ServerAlias *.dev
@mlebkowski
mlebkowski / combined-ids.php
Created September 17, 2014 14:26
combined ids
<?php
function compositeId($calendarId, \DateTime $start) {
static $startOfTime = 1410963347;
$time = ($start->getTimestamp() - $startOfTime) / 60 / 5;
if ($time & 0xFFFF0000) {
throw new RuntimeException(sprintf('We have ran out of time: %s!', $start->format('Y-m-d H:i:s')));
}
if ($calendarId & 0xFFFF0000) {
throw new RuntimeException(sprintf('We are too successful (calendarId: %d)', $calendarId));

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:

@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\
@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";
<?php
class QueryDependent
{
/**
* @var Callable
*/
private $queryFactory;
<?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
$retry = [
"today" => 'failure-notification',
'+1 day' => 'none',
'+3 days' => 'failure-notification',
'+1 week' => 'failure-notification',
'+2 weeks' => 'failure-notification, suspend'
];
?>