This file contains hidden or 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 Modern::Perl; | |
| use List::Util qw/first sum/; | |
| my @elements = (["low", 10], ["mid", 100], ["high", 1000]); | |
| my $accum = 0; | |
| my $total = sum map { | |
| $_->[2] = $accum += $_->[1]; |
This file contains hidden or 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 Modern::Perl; | |
| use List::Util qw/sum/; | |
| my @elements = (["low", 10], ["mid", 100], ["high", 1000]); | |
| my $accum = 0; | |
| my $total = sum map { | |
| $_->[2] = $accum += $_->[1]; |
This file contains hidden or 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 perl6 | |
| my $s = IO::Socket::INET.new(:host<abc.net.au>, :port(80)); | |
| $s.print("GET / HTTP/1.0\r\nHost: abc.net.au\r\n\r\n"); | |
| # Too many positionals passed; expected 1 argument but got 2 | |
| # in block <unit> at /home/spacebat/sock.pl6:4 |
This file contains hidden or 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 | |
| # Adapted from tutorial Copyright (c) 2013 Peter Stuifzand | |
| # at http://marpa-guide.github.io/chapter3.html | |
| # In particular this is an attempt at Exercise 3 | |
| use strict; | |
| use warnings; | |
| package Authorization; |
This file contains hidden or 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
| ;; See http://malisper.me/2015/11/10/defmemo/ | |
| (defmacro defmemo (name-and-cache args &body body) | |
| "Define a memoized function. NAME-AND-CACHE may be a symbol naming | |
| the function, or a property list in which case the name is specified | |
| in the property :name. When a list is supplied, a set of functions | |
| named by the properties :cache, :reader and :writer may be | |
| supplied. The cache function must return an object that supports a | |
| protocol like hash-table with equality test sufficient to discriminate | |
| the arguments to the memoized function. The reader accepts |
This file contains hidden or 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
| (defconst my/lookup-extra-handlers nil) | |
| (cl-defun my/lookup (map key &key default test type) | |
| (typecase map | |
| (list | |
| (case type | |
| (plist (getf map key default)) | |
| (list (nth key map)) | |
| (t (let ((cell (assoc key map))) | |
| (if cell |
This file contains hidden or 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
| (defun char-successor(c) | |
| "values are succesor and carry, same case for letters" | |
| (cond | |
| ((char= c #\9) (values #\0 t)) | |
| ((char= c #\Z) (values #\A t)) | |
| ((char= c #\z) (values #\a t)) | |
| ((alphanumericp c) (values (code-char (1+ (char-code c))) nil)) | |
| (t (values c t)))) | |
| (defun string-successor(s) |
This file contains hidden or 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
| ;; An example of append method combination to form a projection of an object's slots | |
| (defclass odour-mixin () | |
| ((odour :initarg :odour :initform nil :reader odour))) | |
| (defclass colour-mixin () | |
| ((colour :initarg :colour :initform nil :reader colour))) | |
| (defclass sound-mixin () | |
| ((sound :initarg :sound :initform nil :reader sound))) |
This file contains hidden or 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
| ;;; Just mucking about with funcallable instances. This class defines | |
| ;;; an instance that "freezes" a specified set of special variable | |
| ;;; bindings at the time of instantiation, so when the instance is | |
| ;;; called these bindings are preserved. This could be achieved with a | |
| ;;; closure, but then you couldn't read and alter the bindings so | |
| ;;; easily. | |
| (ql:quickload :closer-mop) | |
| (defclass icicle () |
This file contains hidden or 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
| // ==UserScript== | |
| // @name Remove signup form | |
| // @namespace http://ubermonkey.net/ | |
| // @version 0.1 | |
| // @description Unbreak boutiquepaws | |
| // @author spacebat | |
| // @include /^https:\/\/www\.boutiquepaws\.com\.au\// | |
| // @grant GM_log | |
| // ==/UserScript== |