Skip to content

Instantly share code, notes, and snippets.

$ perl6 -e '
my %h;
for lines("lib/November.pm") -> $line {
for $line.comb -> $word {
++%h{$word}
}
}
say .value, "\t", .key for %h.sort({ $^b.value <=> $^a.value })[^10]'
60 {
48 =
$ git di
diff --git a/build/gen_setting_pm.pl b/build/gen_setting_pm.pl
index 7d97aea..7141e8a 100644
--- a/build/gen_setting_pm.pl
+++ b/build/gen_setting_pm.pl
@@ -22,8 +22,10 @@ foreach my $file (@files) {
my @classes = ('Any');
foreach my $file (@files) {
- next unless $file =~ /[\/\\](\w+)\.pm$/;
$ cat hitomi-example.xml
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:pe="http://github.com/masak/hitomi">
<head>
<title>Slurp: News</title>
</head>
<body class="index">
<div id="header">
<h1>News</h1>
$ cat hitomi-example.xml
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:pe="http://github.com/masak/hitomi">
<head>
<title>Slurp: News</title>
</head>
<body class="index">
<div id="header">
<h1>News</h1>
for (Class<?> interfaze
: findAllPublishedInterfaces(manager.getClass()))
// Is there a death punishment for calling a variable '_'?
// I think it's nice.
for (String _ : new String[] {
interfaze.getAnnotation(PublishedClass.class).value(),
NEWLINE,
NEWLINE,
" This manager has the following methods:",
NEWLINE } )
private static Map<String, String[]> topLevelCommands
= new HashMap<String, String[]>() {{
// { "fn name" => [ "parameters", "fn body" ] }
put("clear", new String[] { "", "js.clear()" } );
put("print", new String[] { "message", "js.print(message)" } );
put("say", new String[] { "message", "js.say(message)" } );
}};
static {
for (Map.Entry<String, String[]> e : topLevelCommands.entrySet())
Double d = new Double(7);
Integer i = new Integer((int)(d.doubleValue()));
System.out.println(i);
$ cat hitomi
use v6;
grammar XML {
regex TOP { ^ <pi>* <xmlcontent>+ {*} $ };
token xmlcontent {
| <node> {*} #= node
| <empty> {*} #= empty
| <content> {*} #= content
sub get-deps($deps-file) {
return unless $deps-file ~~ :f;
my &remove-line-ending-comment = { .subst(/ '#' .* $ /, '') };
my &trim-spaces = { .subst(/ ^ \h+ /, '').subst(/ \h+ $ /, '') };
return slurp($deps-file)\
.split("\n")\
.map({remove-line-ending-comment($^line)})\
.map({trim-spaces($^line)})\
.grep({$^keep-all-nonempty-lines});
}