Skip to content

Instantly share code, notes, and snippets.

View kraih's full-sized avatar

Sebastian Riedel kraih

View GitHub Profile
@kraih
kraih / local_lib.txt
Created June 5, 2019 11:54
Use multiple versions of the same Perl library with local::lib
$ cpanm -Lperltidy_new Perl::Tidy
--> Working on Perl::Tidy
...
1 distribution installed
$ cpanm -Lperltidy_old Perl::Tidy@20181120
--> Working on Perl::Tidy
...
1 distribution installed
@kraih
kraih / Auth.pm
Last active September 25, 2018 18:34
Bits and pieces that will hopefully some day become an OpenID plugin for Mojolicious (with alternative dummy backend for testing and token backend for API users)
package MyApp::Controller::Auth;
use Mojo::Base 'Mojolicious::Controller';
sub check {
my $self = shift;
my $role = $self->stash('role');
my $user = $self->current_user;
# User needs to log in or a different role
module.exports = {
config: {
backgroundColor: "#2e3440",
borderColor: "#3b4252",
colors: {
black: "#3b4252",
blue: "#81a1c1",
cyan: "#88c0d0",
green: "#a3be8c",
lightBlack: "#4c566a",

Keybase proof

I hereby claim:

  • I am kraih on github.
  • I am kraih (https://keybase.io/kraih) on keybase.
  • I have a public key whose fingerprint is 6BA8 BB3D 9A3D 17A2 DD2B ADDA A4F2 2996 1D48 27F5

To claim this, I am signing this object:

{
"editor.fontFamily": "'Consolas",
"editor.fontSize": 13,
"editor.minimap.enabled": false,
"editor.renderIndentGuides": false,
"editor.renderWhitespace": "boundary",
"editor.rulers": [80],
"editor.tabSize": 2,
"emmet.includeLanguages": {
"mojolicious": "html"
#!/usr/bin/perl
use 5.24.0;
use Mojo::UserAgent;
use IO::Socket::SSL;
my %LANGUAGES = (
# SLE main languages
use Mojolicious::Lite;
use Mojo::IOLoop;
sub fib { $_[0] < 2 ? 1 : fib($_[0] - 2) + fib($_[0] - 1) }
get '/fibonacci' => sub {
my $c = shift;
$c->inactivity_timeout(300);
use Mojolicious::Lite;
use Mojo::EventEmitter;
helper events => sub { state $events = Mojo::EventEmitter->new };
get '/' => 'chat';
websocket '/channel' => sub {
my $c = shift;
$ perl5.16 -Mre=debug -E 'my $x = "y"; "y" =~ /z$x/ for 1 .. 2'
Compiling REx "zy"
Final program:
1: EXACT <zy> (3)
3: END (0)
anchored "zy" at 0 (checking anchored isall) minlen 2
Freeing REx: "zy"
#!/usr/bin/xcrun swift -i
println("Hello World!")