Skip to content

Instantly share code, notes, and snippets.

View malukenho's full-sized avatar
😴
Welterusten

Jefersson Nathan malukenho

😴
Welterusten
View GitHub Profile
@danizord
danizord / AuthenticationListener.php
Last active January 1, 2016 07:39
Redirects unauthenticated users to login
<?php
namespace MyApp\Authentication;
use Zend\EventManager\AbstractListenerAggregate;
use Zend\EventManager\EventManagerInterface;
use Zend\Mvc\MvcEvent;
use Zend\Stdlib\ResponseInterface;
/**
anonymous
anonymous / answer.txt
Created August 27, 2016 11:24
I think the best way to answer this definitively without just handwaving
and talking about the C preprocessor is to actually write two small
example programs and compare the generated code from both. When I was
first learning C I did this constantly trying to understand how the
compiler worked. You don't need to understand assembly in great detail
to be able to spot differences in the output:
$ cat a.c
int main() {
char *line = "HTTP/1.0 500 Internal Server Error";
@nnja
nnja / nina.zsh-theme
Last active February 23, 2017 00:47
My zshell prompt theme, a bastardization of robbyrussel & kolo themes
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats '%c%u%B%F{green} '
apiVersion: v1
kind: Pod
metadata:
labels:
name: liveness-probe-exec
spec:
containers:
- name: liveness-probe
image: busybox
args:
PHP 20 hrs 17 mins █████████████▌░░░░░░░ 64.7%
Docker 90 mins █▉░░░░░░░░░░░░░░░░░░░ 9.5%
Other 55 mins █▍░░░░░░░░░░░░░░░░░░░ 7.1%
YAML 23 mins █▎░░░░░░░░░░░░░░░░░░░ 6.5%
Markdown 33 mins █▎░░░░░░░░░░░░░░░░░░░ 6.4%
@Ocramius
Ocramius / .gitignore
Last active January 10, 2023 16:34
`Zend\EventManager` examples
vendor
composer.lock
@Ocramius
Ocramius / handling-optional-input-fields-with-type-safe-abstractions.md
Last active March 17, 2023 12:06
Handling optional input parameters in PHP with `vimeo/psalm` and `azjezz/psl`

Handling optional input parameters in PHP with vimeo/psalm and azjezz/psl

I had an interesting use-case with a customer for which I provide consulting services: they needed multiple fields to be marked as "optional".

Example: updating a user

We will take a CRUD-ish example, for the sake of simplicity.

For example, in the following scenario, does a null $description mean "remove the description",