Skip to content

Instantly share code, notes, and snippets.

diff --git a/ufo b/ufo
index ddcfd58..9755c47 100755
--- a/ufo
+++ b/ufo
@@ -11,7 +11,7 @@ elsif 'lib' !~~ :d {
exit;
}
-my @module-files = grep { $_ }, split "\n", qx[find lib -name \*.pm];
+my @module-files = grep { $_ }, split "\n", qx[find lib -name \*.pm -or -name \*.pm6];
use v6;
# module OSUtils;
# Removed 'is export's
multi sub cwd() {
Q:PIR {
$P0 = root_new ['parrot';'OS']
push_eh cwd_catch
diff --git a/ufo b/ufo
index bcdf016..5c0c51f 100755
--- a/ufo
+++ b/ufo
@@ -1,5 +1,7 @@
#!/usr/bin/env perl6
+#use OSUtilsOrSomething;
+
my $binary = 'perl6';
use v6;
role Keyed[*@keys] is Associative {
my %index;
submethod BUILD() {
for @keys.kv -> $i, $v {
%index{$v} = $i;
}
}
diff --git a/src/glue/run.pir b/src/glue/run.pir
index 3ff1a93..1da169c 100644
--- a/src/glue/run.pir
+++ b/src/glue/run.pir
@@ -105,6 +105,12 @@ of the compilation unit.
$P2 = '&CREATE_HASH_FROM_LOW_LEVEL'(env)
set_hll_global '%ENV', $P2
+ # Set up $*OSNAME
+ .local pmc osname
use v6;
role Finalizable[Callable $finalizer] {
method finalize() {
$finalizer();
}
}
multi sub infix:<do>(Finalizable $finalizable, Callable $callable) {
# XXX should call $callable in caller's context
role ListExtension {
multi method take($num as Int) {
@(self)[^$num];
}
multi method takewhile($condition) {
gather for @(self) -> $item {
$item ~~ $condition ?? take $item !! last;
}
}
@uasi
uasi / gist:628449
Created October 15, 2010 16:06
Show downloadable URL for Dailymotion video
javascript:(function(){prompt('Download%20Link',decodeURIComponent(/hqURL%2522%253A%2522(.+?)%2522/.exec(document.body.innerHTML)[1].replace(/%255C/g,'')));})();
require 'formula'
# Nethack the way God intended it to be played: from a terminal.
# This build script was created referencing:
# * http://nethackwiki.com/wiki/Compiling#On_Mac_OS_X
# * http://nethackwiki.com/wiki/Pkgsrc#patch-ac_.28system.h.29
# and copious hacking until things compiled.
#
# The patch applied incorporates the patch-ac above, the OS X
# instructions from the Wiki, and whatever else needed to be
@uasi
uasi / jnethack.rb
Created November 26, 2010 11:09
JNetHack formula (this formula is outdated; try `brew install jnethack`)
require 'formula'
# Nethack the way God intended it to be played: from a terminal.
# This formula is based on Nethack formula.
# The patches in DATA section are shamelessly stolen from MacPorts' jnethack portfile.
class Jnethack <Formula
url 'http://downloads.sourceforge.net/project/nethack/nethack/3.4.3/nethack-343-src.tgz'
homepage 'http://www.nethack.org/index.html'