This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(w) { | |
/* | |
* Allow multiple clients share the same connection, but send/receive data on a topic they want | |
* | |
* var ws = WebSocketChannel("wss://example.com/mux", "testTopic"); | |
* var ws = WebSocketChannel("wss://example.com/mux", {topic: "..", protocols: ...}); | |
* var ws = WebSocketChannel({url: "wss://example.com/mux", topic: "..", protocols: ...}); | |
* ws.onopen = function(e) { this.send({some: data}) }; | |
*/ | |
w.WebSocketChannel = function(url, params) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ClassMeta; | |
use Mojo::Base -strict; | |
use Hook::AfterRuntime; | |
use B::Hooks::EndOfScope; | |
sub import { | |
my $class = shift; | |
my $caller = caller; | |
my %meta = (ATTRS => {}, METHODS => {}); | |
my %ignore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
label.checkbox, | |
label.radio { | |
cursor: pointer; | |
position: relative; | |
} | |
label.checkbox input + span, | |
label.radio input + span { | |
margin-left: 1.6rem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojo/JWT.pm b/lib/Mojo/JWT.pm | |
index 11fdb2b..0281ff1 100644 | |
--- a/lib/Mojo/JWT.pm | |
+++ b/lib/Mojo/JWT.pm | |
@@ -5,6 +5,9 @@ use Mojo::Base -base; | |
our $VERSION = '0.05'; | |
$VERSION = eval $VERSION; | |
+our @EXPORT_OK = qw/decode_jwt encode_jwt/; | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Mojo::JSON::Patch; | |
use Mojo::Base 'Mojo::JSON::Pointer'; | |
use Carp 'croak'; | |
use Mojo::Path; | |
sub set { | |
my $self = shift; | |
my $path = Mojo::Path->new(shift); | |
my $val = shift; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use FindBin; | |
use lib $FindBin::Bin; | |
my %u; | |
opendir(my $DP, '.') or die $!; | |
while (my $p = readdir $DP) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package void; | |
use strict; | |
use Exporter 'import'; | |
use Carp; | |
our @EXPORT = 'void'; | |
sub void { | |
return unless defined wantarray; | |
my $caller = (caller 1)[3]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
use List::Util 'reduce'; | |
use Time::Piece; | |
use Time::Seconds; | |
sub off { | |
return ( | |
'01-01' => 'Nyttårsdag', | |
'04-02' => 'Skjærtorsdag', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# nytprofmojo.sh <time> <port> | |
# nytprofmojo.sh 10s 8080 | |
MOJO_PORT=${2:-3456} | |
perl -d:NYTProf -Ilib examples/hello.pl daemon -l http://*:$MOJO_PORT -m production 2>stderr.log & | |
MOJO_PID=$! | |
sleep 1 | |
wrk -c 100 -d ${1:-10} http://localhost:$MOJO_PORT | |
kill $MOJO_PID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2261536/hack.sh | sh | |
# |