Skip to content

Instantly share code, notes, and snippets.

View Altai-man's full-sized avatar

Altai-man

  • Edument Central Europe sro.
View GitHub Profile
Index: templates/search_template.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- templates/search_template.js (revision cb5268de29e8692d71fb7ef3b720fd41bfe28b7d)
+++ templates/search_template.js (date 1615154815552)
@@ -1,6 +1,44 @@
-//WARNING
var current_search = "";

Examples website revival proposal

This document describes briefly the current state of Raku examples repo and asks for comments on plans related to it.

It is a rather old repo (created back in 2008), which contains various examples of Raku code and has means to present them as a website.

As in 2020, it has a number of drawbacks (some of them were described by Timo++ in Raku/user-experience#24):

  • The website does not support some essential features (such as search, easy navigation)
  • The website UI can be more of an eye-candy, especially considering the same UI is used on doc website
func gen(nums ...int) <-chan int {
out := make(chan int)
go func() {
for _, n := range nums {
out <- n
}
close(out)
}()
return out
}
use Cro::WebSocket::Client;
use Cro::HTTP::Router;
use Cro::HTTP::Router::WebSocket;
use Cro::HTTP::Server;
my $application = route {
get -> 'chat' {
web-socket(-> $incoming {
supply {
whenever $incoming -> $message { # This will be executed even after server's `stop` call

List of missing native libraries

  • libfann.so
  • liblbfgs.so
  • mpd is not installed and run
  • archive (libarchive)
  • mp3lame
  • shout
  • libvorbis
  • libtag_c.so
my $c = Channel.new;
my $end = $c.closed;
# Example of task to keep channel busy
supply { # Don't forget to pull items from the channel, otherwise $close will not be kept.
for (0..2) { {$c.close;done} if $_ == 2; .say; sleep 0.5; }
}.tap;
my $timeout = Promise.in(5);
my $timeout-or-good = Promise.anyof($end, $timeout);
await $timeout-or-good.then(
➜ 1 git:(master) zef --installed list
===> Found via /home/sena/.rakudobrew/moar-nom/install/share/perl6
CORE:ver('6.c'):auth('perl')
===> Found via /home/sena/.rakudobrew/moar-nom/install/share/perl6/site
JSON::Fast:ver('0.9.1') # === Here it is, nice and clear;
JSON::Marshal:ver('0.0.11'):auth('github:jonathanstowe') # === And the last version is here too.
OpenSSL:ver('0.1.11'):auth('github:sergot')
zef:ver('0.1.25'):auth('github:ugexe')
JSON::Name:ver('0.0.2'):auth('github:jonathanstowe')
➜ 1 git:(master) perl6
@Altai-man
Altai-man / gist.txt
Created April 29, 2017 05:04
Missing native libraries or so
1 Cannot locate native library 'libgumbo.so.1': libgumbo.so.1: cannot open shared object file: No such file or directory
2 Cannot locate native library 'liblibSDL.so': liblibSDL.so: cannot open shared object file: No such file or directory
3 # Cannot locate native library 'liblmdb.so.0.0.0': liblmdb.so.0.0.0: cannot open shared object file: No such file or directory
4 Cannot locate native library 'liblmdb.so.0.0.0': liblmdb.so.0.0.0: cannot open shared object file: No such file or directory
5 Cannot locate native library 'liblua5.1.so': liblua5.1.so: cannot open shared object file: No such file or directory
6 Cannot locate native library 'libMagickWand.so': libMagickWand.so: cannot open shared object file: No such file or directory
7 # Cannot locate native library 'libmarkdown.so': libmarkdown.so: cannot open shared object file: No such file or directory
8 Cannot locate native library 'libnotmuch.so': libnotmuch.so: cannot open shared object file: No such file or direct
use v6;
use NativeCall;
sub fopen(Str $filename, Str $mode) returns OpaquePointer is native() is export { * }
sub call(Str $way, bool $is-read) { # bool from NativeCall.
if $is-read {
fopen($way, "r");
} else {
fopen($way, "w");
@Altai-man
Altai-man / Example.pl6
Last active January 9, 2016 10:41
Native call expected return type with CArray representation, but got a VMArray
use v6;
use NativeCall;
# Needed bindings.
our sub fopen(Str $filename, Str $mode) returns OpaquePointer is
native() { ... }
our sub close(OpaquePointer $handle) is native() { ... }
# Bingings to bzip2(only needed parts).
our sub BZ2_bzWriteOpen(Pointer[int32], OpaquePointer, int32, int32, int32) returns OpaquePointer is native("/lib/libbz2.so.1") is export { * }