Skip to content

Instantly share code, notes, and snippets.

@masak
masak / Jakefile
Created October 23, 2013 15:52
My very small Jakefile
var jake = require("jake");
task("hello", function () { # change this to 'jake.task(...' and things stop working :/
console.log("Hello");
});
@masak
masak / use-cases.md
Created October 20, 2013 20:31
Use cases for macros

So far only one use case, because (a) I haven't had time to write about the other ones, and (b) this was the one that came to mind quite strongly today.

The each junction

There has been talk about this junction now and then; both on the #perl6 channel and in S09. Its semantics is pretty clear: put a list in a position where a scalar is expected, causing the statement to be executed for each of the list's elements.

%hash{each <foo bar baz>} = True;       # assign each hash key

promote(each @employees);               # call with each element as argument
@masak
masak / example.txt
Created October 17, 2013 12:24
Example of a current directory being removed when the last file in it is 'git rm'-ed
/tmp $ git init example
Initialized empty Git repository in /tmp/example/.git/
/tmp $ cd example
/tmp/example $ mkdir foo
/tmp/example $ touch foo/bar
/tmp/example $ git add foo/bar
/tmp/example $ git commit -m 'add foo/bar'
[master (root-commit) 4fce4e5] add foo/bar
0 files changed
create mode 100644 foo/bar
@masak
masak / 0001-IO-Path-attribute-s-path-pathstr.patch
Created September 17, 2013 15:29
change $!path to $!pathstr in IO::Path
From a15adc19a622d4e7f121047ac73d427d8e2b408f Mon Sep 17 00:00:00 2001
From: Carl Masak <[email protected]>
Date: Tue, 17 Sep 2013 17:27:53 +0200
Subject: [PATCH] IO::Path attribute s/path/pathstr/
---
src/core/IO.pm | 46 +++++++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/core/IO.pm b/src/core/IO.pm
@masak
masak / errors.txt
Created August 25, 2013 21:24
Moar build errors!
$ make
compiling src/main.o
compiling src/core/args.o
src/core/args.c: In function ‘init_named_used’:
src/core/args.c:3:47: warning: unused parameter ‘tc’ [-Wunused-parameter]
src/core/args.c: In function ‘MVM_args_proc_cleanup_for_cache’:
src/core/args.c:30:56: warning: unused parameter ‘tc’ [-Wunused-parameter]
src/core/args.c: In function ‘MVM_args_slurpy_named’:
src/core/args.c:479:17: warning: statement with no effect [-Wunused-value]
src/core/args.c:483:17: warning: statement with no effect [-Wunused-value]
@masak
masak / build-problems.txt
Created August 25, 2013 21:20
build problems on libuv5+no_apr_atomic
$ perl Configure.pl
Welcome to MoarVM!
Updating submodules .................................... OK
Configuring native build environment ................... OK
make: make
compile: gcc -D_REENTRANT -D_LARGEFILE64_SOURCE -g -Wall -Wextra
link: gcc -g
libs: -lm -lpthread -luuid -lrt
@masak
masak / hmmm.txt
Created August 25, 2013 21:12
Hm, the obvious thing didn't work
$ git diff
diff --git a/src/moarvm.h b/src/moarvm.h
index 08560b8..c0b7057 100644
--- a/src/moarvm.h
+++ b/src/moarvm.h
@@ -1,18 +1,5 @@
#include <stdlib.h>
-/* Pull in the APR. */
-#define APR_DECLARE_STATIC 1
@masak
masak / classify.txt
Created July 31, 2013 13:42
A classify of my own
>>> oddness = lambda n: n % 2
>>> oddness(0)
0
>>> oddness(3)
1
>>> def classify(things, func):
... result = {}
... for t in things:
... if func(t) in result:
... result[func(t)].append(t)
use v6;
### CODE GOES HERE ###
my $matrix =
┌ ┐
│ 1, 2, 3 │
│ 4, 5, 6 │
└ ┘
@masak
masak / echo.pl
Created July 28, 2013 06:25
Perl 6 echo implementation, similar to adu++'s http://straymindcough.blogspot.se/2013/06/rust-echo.html
sub MAIN(*@words, Bool :$n) {
print @words.join(' ');
print "\n" unless $n;
}