Skip to content

Instantly share code, notes, and snippets.

@nsfisis
nsfisis / 1.pl
Created February 13, 2024 03:20
YAPC::Hiroshima 2024 Perlbatross
binmode STDIN,':utf8';print/(\X)\X/g,$",/\X(\X)/g,$/while<>;
<?;("printf")("Hello, World!"??"_");("_"??"!dlroW ,olleH")("ftnirp");?>
@nsfisis
nsfisis / quine.php
Created October 7, 2022 13:09
quine in php with these limitations: 2 letters per line except <?php, whitespace is prohibited except for line feed
<?php
$s
='
$s
=@
!!
@;
$p
=@
<?php
// Instantiate arbitrary class without "new" operator.
function ffi_get_php_dll_name() {
if (PHP_OS_FAMILY === 'Windows') {
return "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll";
} else {
return null;
}
@nsfisis
nsfisis / fizzbuzz.php (2 letters per line, and supports PHP 8.x without warnings)
Last active September 28, 2022 13:52
fizzbuzz in php with these limitations: 3 letters per line except <?php, whitespace is prohibited except for line feed
<?php
$x
=#
'i
S'
;;
$y
='
b!
@nsfisis
nsfisis / hoge.php
Created August 27, 2022 08:55
PHP でコードゴルフ in PHP Okinawa
// https://speakerdeck.com/memory1994/php-conference-okinawa-2022-extra
[<?php $n=$argv[1];foreach([1e4,5e3,2e3,1e3,500,100,50,10,5,1]as$x)for(;$n>=$x;$n-=$x)$r[]=$x;echo implode(', ',$r??[]);?>]