Skip to content

Instantly share code, notes, and snippets.

View marcioAlmada's full-sized avatar
🚀

Márcio Almada marcioAlmada

🚀
View GitHub Profile
#unbind C-b
#set -g prefix C-b
# allow mouse
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# set -g mode-mouse on # alternatve way
set -g mode-mouse off
# better window split behavior
unbind '%'
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
@marcioAlmada
marcioAlmada / palette.sh
Last active August 29, 2015 14:21
colors
palette ()
{
echo -en "\n + ";
for i in {0..35};
do
printf "%2b " $i;
done;
printf "\n\n %3b " 0;
for i in {0..15};
do
<?php
/**
* Macro to backport enum from the future
*/
macro {
enum T_STRING·name {
·ls
(
·rtoken('/^\w+$/')·field
--TEST--
Non delimited layer matching
--FILE--
<?php
macro {
(T_STRING·A ···rest) // matches a lisp form
} >> {
T_STRING·A(···rest)
}
@marcioAlmada
marcioAlmada / semi_reserved-php7.1.txt
Created August 31, 2015 22:19
List of tokens that can be used as class member identifiers on PHP7
T_INCLUDE
T_INCLUDE_ONCE
T_EVAL
T_REQUIRE
T_REQUIRE_ONCE
T_LOGICAL_OR
T_LOGICAL_XOR
T_LOGICAL_AND
T_INSTANCEOF
T_NEW
@marcioAlmada
marcioAlmada / room11-sidebar.css
Created September 21, 2015 16:22
Use with stylish browser extension.
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url("http://chat.stackoverflow.com/rooms/11/php") {
#sidebar {
bottom: 88px;
height: auto;
overflow: auto;
padding-left:34px;
}
<?php declare(strict_types=1);
function crunch_data(array $data, callable(int $left, int $right): int $callback): array {
$result = [];
foreach($data as $left => $right) $result[] = $callback($left, $right);
return $result;
}
$crunched = crunch_data([1 => 2, 3 => 4], function(int $left, int $right): int {
callable_arg_type_list:
/* empty */ { $$ = NULL; }
| '(' ')' { $$ = zend_ast_create_list(0, ZEND_AST_PARAM_LIST); }
| T_INT_CAST {
zval zv;
ZVAL_STRINGL(&zv, "int", sizeof("int")-1);
zend_ast *type = zend_ast_create_zval_ex(&zv, ZEND_NAME_NOT_FQ);
zend_ast *arg = zend_ast_create_ex(ZEND_AST_PARAM, 0, type, NULL, NULL);
zend_ast *args = zend_ast_create_list(0, ZEND_AST_PARAM_LIST);
zend_ast_list_add(args, arg);
@marcioAlmada
marcioAlmada / opaque_types.php
Created November 17, 2015 01:44
second order macros FTR
--TEST--
Opaque types with macros that generate other macros :>
--FILE--
<?php
macro {
type T_STRING·newtype = T_STRING·basetype;
} >> {
macro { T_STRING·newtype } >> { T_STRING·basetype }
}