Skip to content

Instantly share code, notes, and snippets.

View zonuexe's full-sized avatar
🤓
PHP is a Lisp. Emacs is Web.

USAMI Kenta zonuexe

🤓
PHP is a Lisp. Emacs is Web.
View GitHub Profile
@zonuexe
zonuexe / my_compact.php
Created May 21, 2018 03:31
compactっぽいユーザーランド実装
<?php
function my_compact(...$var_names)
{
$names = [];
foreach ($var_names as $n) {
if (is_string($n)) {
$names[] = $n;
} else {
$names = array_merge($names, $n);
This file has been truncated, but you can view the full file.
<?php
call_user_func(function(){
$a = 0;
$b = 0;
$c = 0;
$d = 0;
$bp = 0;
$sp = 0;
$pc = 0;
$running = true;
@zonuexe
zonuexe / README.md
Created December 1, 2017 16:34
架空のSDKセットアップスクリプト

これは架空のスクリプトなので動作確認はしてません

@zonuexe
zonuexe / more-187-fizzbuzz.php
Last active September 21, 2017 17:50
もっと嫌なFizzBuzz
<?php call_user_func($f=function($n)use(&$f){if(!$n)return;$f($n-1);echo $n%3?($n%5?$n:'Buzz'):($n%5?'Fizz':'FizzBuzz'),PHP_EOL;}, count(call_user_func(function (){$f=fopen(__FILE__, 'r');return explode("\n", stream_get_contents($f));})));
@zonuexe
zonuexe / file0.txt
Last active September 5, 2017 10:50
PHP: Clean Code (clean-code-php) 蜜柑薬 ref: http://qiita.com/tadsan/items/c47eb327684530721e8a
The MIT License (MIT)
Copyright (c) 2016 Ryan McDermott
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@zonuexe
zonuexe / keyfreq_20170822a.txt
Last active August 22, 2017 04:08
keyfreqでいい感じにデータが溜まってきた
For all major modes:
100444 22.61% next-line C-n, <down>
78375 17.64% self-insert-command SPC..~, \200..¤, ¦..\377
74603 16.79% previous-line C-p, <up>
13431 3.02% left-word <C-left>
11516 2.59% right-word <C-right>
9502 2.14% move-end-of-line C-e
9355 2.11% right-char <right>
8838 1.99% left-char <left>
@zonuexe
zonuexe / test.org
Created August 14, 2017 12:14
Org mode rendering test

http://orgmode.org/manual/Emphasis-and-monospace.html#Emphasis-and-monospace

You can make words bold, italic, underlined, verbatim and code, and, if you must, strike-through. Text in the code and verbatim string is not processed for Org mode specific syntax, it is exported verbatim.

You can make words bold, italic, underlined, verbatim and code, and, if you must, strike-through. Text in the code and verbatim string is not processed for Org mode specific syntax, it is exported verbatim.

#Heading
*I'm zonuexe
@zonuexe
zonuexe / zend_language_parser.y.patch
Created July 22, 2017 13:15
PHPにihuとerusuを追加するやつ
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 2c508a59fe..47d2ff5af9 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -82,8 +82,11 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%nonassoc T_NEW T_CLONE
%left T_NOELSE
%left T_ELSEIF
+%left T_ERUSUIHU
%left T_ELSE
@zonuexe
zonuexe / php-lang-constructs.md
Last active May 19, 2017 01:27
PHP 配列っぽいもの列伝
構文 意味
array 配列リテラル array(1, 2)
die PHPスクリプトの終了 foo() or dir(1);
echo 文字列を標準出力 echo $message, PHP_EOL;
empty 値/変数が「空」または「偽」かの検査 if (empty($v) || empty($a['i']))
eval 文字列をPHPスクリプトとして評価 eval($s)
exit PHPスクリプトの終了 exit(0);
include、include_once PHPスクリプトの読み込み include_once __DIR__ . '/Foo.php';
isset 値/変数が存在するかの検査 $v = isset($a['i']) ? $a['i'] : 's';