Skip to content

Instantly share code, notes, and snippets.

View mkarnicki's full-sized avatar

Michał Karnicki mkarnicki

View GitHub Profile
@threepointone
threepointone / feature-flags-client-implementation.md
Last active June 1, 2023 18:35
Implementing a client for feature flags

On implementing a client for feature flags in your UI codebase

This document isn't an explainer on Feature Flags, you can find that with my amateur writeup, or literally hundreds of better writeups out there.

This document is also agnostic to the choice of service you'd use: LaunchDarkly or split.io or optimizely or whatever; that's orthogonal to this conversation.

Instead, this document is a list of considerations for implementing a client for using Feature Flags for User Interface development. Service providers usually give a simple fetch and use client and that's it; I contend that there's a lot more to care about. Let's dive in.

To encourage usage, we'd like for the developer experience to be as brutally simple as possible. So, this should be valid usage:

@geoffreydhuyvetters
geoffreydhuyvetters / refactoring.md
Last active March 19, 2020 17:01
refactoring rendering

BEFORE

const Component = () = {

  // a
  // lot
  // of 
 // logic
@themsaid
themsaid / AppServiceProvider.php
Created January 26, 2020 16:24
Re-encryption after APP_KEY rotation
<?php
namespace App\Providers;
use App\Encrypter;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active April 9, 2024 14:08
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@leocavalcante
leocavalcante / watch.php
Created February 21, 2019 20:45
Watch script for Swoole HTTP server restarts.
<?php declare(strict_types=1);
require_once __DIR__.'/vendor/autoload.php';
use Symfony\Component\Process\Process;
$process = new Process(['php', 'index.php']);
echo "Starting process\n";
$process->start();
@ixdy
ixdy / yubikey4-ssh-macos.md
Last active April 12, 2024 20:19
Setting up ssh public key authentication on macOS using a YubiKey 4

Setting up ssh public key authentication on macOS using a YubiKey 4

I largely followed Florin's blog post, but have a few notes to add regarding issues I encountered:

Basic setup notes

  1. I used a YubiKey 4, while the blog describes using a YubiKey NEO. I'm sure a YubiKey 5 would also work. I'm also running macOS 10.13.6.
  2. I installed GPGTools as recommended. However, as I'll note later, it seems that gpg-agent only automatically starts when gpg is used; for ssh, you'll need to ensure it's running.
  3. Before generating your keys, decide what key size you want to use. If you run the list command inside gpg --edit-card, look for the Key attributes line to see what is currently selected. On my YubiKey 4, it defaulted to 2048 bits for all keys:
Key attributes ...: rsa2048 rsa2048 rsa2048
@Stunext
Stunext / HandlePutFormData.php
Created November 20, 2018 20:12
Laravel: Middleware to support multipart/form-data in PUT, PATH and DELETE requests
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* @author https://github.com/Stunext
*
autosize
axios
chart.js
collect.js
copy-to-clipboard
delegate
dom-autoscroller
dropzone
electron
emoji-regex
@simonhamp
simonhamp / BaseModel.php
Last active March 25, 2020 16:57
Eloquent: Simple Model Event Handling
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
/**
* Override the default boot method to register some extra stuff for every child model.
@mirzabusatlic
mirzabusatlic / FixCashierNamespace.php
Last active October 21, 2018 08:25
Add a sub-namespace to Laravel Cashier when using both Stripe and Braintree packages
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Finder\Finder;
class FixCashierNamespace extends Command
{
/**