Skip to content

Instantly share code, notes, and snippets.

View xiaocang's full-sized avatar
👋

Johnny Wang xiaocang

👋
View GitHub Profile
# test on https://paiza.io/projects/2JtexjaS6Lsz5p2fY2hnuw?language=perl
use Encode;
# \{3001} 、
# \201c “
my $symre
= qq/\x{3002}|\x{ff1f}|\x{ff01}|\x{ff0c}|\x{ff1b}|\x{ff1a}|\x{2018}|\x{2019}|\x{ff08}|\x{ff09}|\x{300a}|\x{300b}|\x{3008}|\x{3009}|\x{3010}|\x{3011}|\x{300e}|\x{300f}|\x{300c}|\x{300d}|\x{fe43}|\x{fe44}|\x{3014}|\x{3015}|\x{2026}|\x{2014}|\x{ff5e}|\x{fe4f}|\x{ffe5}|\x{a0}/;
my %counts;
while (<>) {
chomp;
@xiaocang
xiaocang / too_much_upvalue.lua
Created October 12, 2018 10:30
too_much_upvalue
local a_1
local a_2
local a_3
local a_4
local a_5
local a_6
local a_7
local a_8
local a_9
local a_10
@xiaocang
xiaocang / too_much_constant.lua
Last active October 12, 2018 10:29
too_much_constant
local a = {
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127", "128", "129", "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150", "151", "152", "153", "154", "155", "156", "157", "158", "159", "16
@xiaocang
xiaocang / variables_in_function.lua
Created October 12, 2018 10:01
variables_in_function
local a_1
local a_2
local a_3
local a_4
local a_5
local a_6
local a_7
local a_8
local a_9
local a_10
@xiaocang
xiaocang / control_pattern_too_long.lua
Last active October 12, 2018 09:04
Lua Stack Limit
--[[
control_pattern_too_long.lua:3297: control structure too long near '<eof>'
]]--
if (1 > 0) and (2 > 0) and (3 > 0) and (4 > 0) and (5 > 0) and (6 > 0) and (7 > 0) and (8 > 0) and (9 > 0) and (10 > 0) and
(11 > 0) and (12 > 0) and (13 > 0) and (14 > 0) and (15 > 0) and (16 > 0) and (17 > 0) and (18 > 0) and (19 > 0) and (20 > 0) and
(21 > 0) and (22 > 0) and (23 > 0) and (24 > 0) and (25 > 0) and (26 > 0) and (27 > 0) and (28 > 0) and (29 > 0) and (30 > 0) and
(31 > 0) and (32 > 0) and (33 > 0) and (34 > 0) and (35 > 0) and (36 > 0) and (37 > 0) and (38 > 0) and (39 > 0) and (40 > 0) and
(41 > 0) and (42 > 0) and (43 > 0) and (44 > 0) and (45 > 0) and (46 > 0) and (47 > 0) and (48 > 0) and (49 > 0) and (50 > 0) and
(51 > 0) and (52 > 0) and (53 > 0) and (54 > 0) and (55 > 0) and (56 > 0) and (57 > 0) and (58 > 0) and (59 > 0) and (60 > 0) and
@xiaocang
xiaocang / pm-template.latex
Created September 1, 2016 07:22
pandoc-issue
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$}
\usepackage{geometry} % 設定邊界
\geometry{
top=1in,
inner=1in,
outer=1in,
bottom=1in,
headheight=3ex,
headsep=2ex
}
#!/usr/bin/env perl [0/3]
use strict;
use warnings;
use Smart::Comments;
my @array = qw{a b c};
my $result = {};
@xiaocang
xiaocang / better_one.lua
Created May 8, 2016 10:16
lua_table_empty
local next = next -- 绑定函数为本地变量
if next(emptyTable) == nil then
print("This is a empty table")
end
@xiaocang
xiaocang / Folder.pm
Created April 6, 2016 14:58
Trie Folder
package Folder;
use Moo;
has trie => (
is => 'rw',
isa => sub { die "$_[0] is not a Trie Obj!" unless ref $_[0] eq "Trie" },
default => sub { Trie->new() }
);
sub read {