Skip to content

Instantly share code, notes, and snippets.

### the patch passes the following tests :)
#?rakudo todo 'unicode'
{ # distribution for unary prefix
my @r;
@r = -« ([1, 2], [3, [4, 5]]);
my @e = ([-1, -2], [-3, [-4, -5]]);
is(~@r, ~@e, "distribution for unary prefix");
@r = -<< ([1, 2], [3, [4, 5]]);
diff --git a/bin/book-to-latex b/bin/book-to-latex
index a909a46..f3f1018 100644
--- a/bin/book-to-latex
+++ b/bin/book-to-latex
@@ -12,6 +12,7 @@ print <<'HEADER';
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage[colorlinks=true,pagebackref]{hyperref}
+\usepackage{wrapfig}
diff --git a/bin/book-to-latex b/bin/book-to-latex
index a909a46..35434d9 100644
--- a/bin/book-to-latex
+++ b/bin/book-to-latex
@@ -12,6 +12,7 @@ print <<'HEADER';
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage[colorlinks=true,pagebackref]{hyperref}
+\usepackage{wrapfig}
@prakashk
prakashk / 24-game.p6
Created September 3, 2010 20:05
24-game in Perl 6
# From: http://rosettacode.org/wiki/24_game
#
# The 24 Game tests one's mental arithmetic.
#
# Write a program that randomly chooses and displays four digits, each
# from one to nine, with repetitions allowed. The program should
# prompt for the player to enter an equation using just those, and all
# of those four digits. The program should check then evaluate the
# expression. The goal is for the player to enter an expression that
# evaluates to 24.
@prakashk
prakashk / ics.webcast.uwex.edu.js
Created June 15, 2012 14:41
Make direct video link for YAPC 2012 Live Streams
$(document).ready(function() {
$(".cardLink").each(function() {
var href = this.href;
var video_id = this.href.split('=')[1].replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})..$/, '$1-$2-$3-$4-$5');
var video_link = "http://video.ics.uwex.edu/" + video_id;
$(this).parent().append('&nbsp;<a href="' + video_link + '">[Video]</a>');
});
});
@prakashk
prakashk / euler-019.clj
Created December 6, 2012 17:41
Project Euler -- problem 19
;; Project Euler -- Problem 19
;; You are given the following information, but you may prefer to do
;; some research for yourself.
;; * 1 Jan 1900 was a Monday.
;; * Thirty days has September,
;; April, June and November.
;; All the rest have thirty-one,
;; Saving February alone,
(require 'generic-x)
;; pkc mode keywords
(setq pkc-keywords-list '("compute" "count" "dedupe" "embed" "file" "frequency" "function"
"join" "keep" "macro" "minus" "print" "project" "result" "select" "union" "use"))
(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(mmm-add-classes
@prakashk
prakashk / moe.sh
Created February 5, 2013 05:36
run moe from command-line
scala -classpath target/scala-2.10/classes:$HOME/.ivy2/cache/commons-cli/commons-cli/jars/commons-cli-1.2.jar:$HOME/.ivy2/cache/jline/jline/jars/jline-2.10.jar org.moe.Moe
(defun copy-comment-paste ()
"copy active region/current line, comment, and then paste"
(interactive)
(unless (use-region-p)
(progn
(beginning-of-line 2)
(push-mark (line-beginning-position 0))))
(kill-ring-save (region-beginning) (region-end))
(comment-region (region-beginning) (region-end))
(yank)
@prakashk
prakashk / 032-package-w-extends.t
Created August 1, 2013 21:06
Creating an instance of a class extended from another in the same package fails.
#!perl
use strict;
use warnings;
use Test::More;
{
package Foo;