Skip to content

Instantly share code, notes, and snippets.

View rn0's full-sized avatar
:bowtie:
testing

Piotr Kapera rn0

:bowtie:
testing
View GitHub Profile
@nkbt
nkbt / .eslintrc.js
Last active May 1, 2024 21:15
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@Couto
Couto / webpack.js
Last active November 11, 2020 17:53
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
@jkrems
jkrems / generators.md
Last active February 24, 2020 19:09
Generators Are Like Arrays

In all the discussions about ES6 one thing is bugging me. I'm picking one random comment here from this io.js issue but it's something that comes up over and over again:

There's sentiment from one group that Node should have full support for Promises. While at the same time another group wants generator syntax support (e.g. var f = yield fs.stat(...)).

People keep putting generators, callbacks, co, thunks, control flow libraries, and promises into one bucket. If you read that list and you think "well, they are all kind of doing the same thing", then this is to you.

@hallettj
hallettj / tree-no_classes.js
Last active October 22, 2021 15:14
Algebraic data type in Javascript with Flow
/* @flow */
type Tree<T> =
| { type: "Node", value: T, left: Tree<T>, right: Tree<T> }
| { type: "EmptyTree" }
function find<T>(p: (v: T) => boolean, t: Tree<T>): T | void {
var l, v
if (t.type === "Node") {
<?php
namespace Payum\SiteBundle\Command;
use Payum\SiteBundle\Model\Library;
use Payum\SiteBundle\Service\LibraryRegistry;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
@jsor
jsor / ddd_cqrs_event-sourcing_in_php.md
Last active April 23, 2024 19:48
DDD, CQRS and Event Sourcing in PHP

DDD, CQRS and Event Sourcing in PHP

  • Broadway - Infrastructure and testing helpers for creating CQRS and event sourced applications
  • EventCentric.Core - Event Sourcing and CQRS in PHP
  • LiteCQRS - Small convention based CQRS library for PHP
  • predaddy - Common DDD classes including an annotation driven message bus and tools for CQRS and Event Sourcing
  • ProophEventSourcing - Provides basic functionality for event-sourced aggregates
  • ProophEventStore - PHP 5.4+ EventStore Implementation
  • ProophServiceBus - PHP Enterprise Service Bus Implementation supporting CQRS and DDD
@sstok
sstok / ShortArraySyntaxFixer.php
Last active August 29, 2015 14:03
ShortArraySyntaxFixer for PHP-CS-Fixer
use Symfony\CS\FixerInterface;
use Symfony\CS\Tokens;
class ShortArraySyntaxFixer implements FixerInterface
{
public function fix(\SplFileInfo $file, $content)
{
$tokens = Tokens::fromCode($content);
for ($index = 0, $c = $tokens->count(); $index < $c; $index++) {
@staltz
staltz / introrx.md
Last active April 29, 2024 09:25
The introduction to Reactive Programming you've been missing
@docteurklein
docteurklein / CompilerPass.php
Last active October 17, 2017 11:39
Service Repository Factory
<?php
public function process(ContainerBuilder $container)
{
$factory = $container->findDefinition('app.doctrine.repository.factory');
$repositories = [];
foreach ($container->findTaggedServiceIds('app.repository') as $id => $params) {
foreach ($params as $param) {
$repositories[$param['class']] = $id;
@johnkary
johnkary / LikeQueryHelpers.php
Last active April 22, 2022 08:09
Proper DQL escaping for LIKE queries with Doctrine 2.
<?php
namespace Foo;
/**
* Methods for safe LIKE querying.
*/
trait LikeQueryHelpers
{
/**