Skip to content

Instantly share code, notes, and snippets.

View worthmine's full-sized avatar

Yuki Yoshida worthmine

View GitHub Profile
@worthmine
worthmine / zennEdit.sh
Last active October 24, 2020 12:43
run and open zenn preview automatically from terminal of your Mac
#!/bin/sh
SOURCE="npx zenn preview"
export DIR="~/Zenn" # 各自のディレクト名にリネームしてください。
if [[ "$(uname)" = "Darwin" ]] && [[ -z "$ON_NEW_TERMINAL" ]] && [[ -z "$NO_NEW_TERMINAL" ]] ; then
osascript -e "
tell application \"Terminal\"
do script \"cd $DIR && $SOURCE\" in window 1
end tell
@worthmine
worthmine / what are declares with omission.pl
Last active October 22, 2020 06:01
In Perl, what is omitted precisely when the variables are declared with omission?
use strict;
use warnings;
use feature qw(say);
say "Firstly, what is returned with defined()?";
say "At line ", __LINE__ + 1, ", if it is defined, ",
( local $_ = defined 1 ) ? "true: '$_'" : "false '$_'";
say "At line ", __LINE__ + 1, ", if it is undef, ",
( local $_ = defined undef ) ? "true: '$_'" : "false '$_'";
@worthmine
worthmine / declare.pl
Last active October 20, 2020 14:37
In Perl, what is omitted precisely when you declare variables with omitting default values?
use strict;
use warnings;
use feature qw(say);
say "## scalars ##"; # スカラは通る
say "---- omitted ----", my $empty; # 省略
if ( defined $empty ) {
die "it's defined! You are Liar!";
} else {
@worthmine
worthmine / detectNonCoreModules.pl
Last active September 25, 2020 10:29
trying to detect for NOT (CORE|EXSISTING) module names in Perl
use 5.008_009; # because Module::CoreList was first released with perl v5.8.9
#use strict; # this line is irrelevant
#use warnings; # this line is irrelevant
use feature qw(say);
#use FastGlob qw(glob); # this line is irrelevant
my @modules = qw(Encode FastGlob CGI Dummy);
#local @INC = qw(lib); # this line is irrelevant
@worthmine
worthmine / solved.md
Last active August 1, 2020 23:16
Where is my mistake?(Solved)
@worthmine
worthmine / FormTest.html
Created July 5, 2019 04:51
a test of form with hidden&readonly
<!DOCTYPE html>
<html>
<head>
<title>form test</title>
</head>
<body>
<form name="test" method="GET" action="">
<input type="email" name="1stEmail"/><br/>
<input type="hidden" name="2ndEmail" value="" readonly/><br/>
@worthmine
worthmine / global.pl
Last active March 29, 2019 08:45
where are global vars?
use feature qw(say);
package Some;
no strict; # to access to ${::,};
use warnings;
local $, = ','; # ${Some::,} is ',' now?
say ${::,} || 'nothing'; # 'nothing'
@worthmine
worthmine / declarations.pl
Last active March 25, 2019 01:34
the strange declaration with our, my and local is here.
use feature qw(say);
use strict;
use warnings;
package Some;
our $n = 100;
sub say_n {
@worthmine
worthmine / flaw.pl
Created March 24, 2019 13:09
Is this a flaw of 'use warnings;' pragma?
use feature qw(say);
use strict;
#use warnings;
our $n = 0;
for ( local our $n = 0; $n < 10; $n++ ) {
say $n;
}
#0
@worthmine
worthmine / local_our.pl
Created March 24, 2019 06:01
declaration local & our at same line
use feature qw(say);
use strict;
use warnings;
for ( local our $n = 0; $n < 10; $n++ ) {
say $n;
}
#0
#1