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
# 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. |
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
$(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(' <a href="' + video_link + '">[Video]</a>'); | |
}); | |
}); |
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
;; 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, |
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
(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 |
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
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 |
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
(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) |
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
#!perl | |
use strict; | |
use warnings; | |
use Test::More; | |
{ | |
package Foo; |
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/perl | |
use feature qw{ say state }; | |
use strict; | |
use warnings; | |
use Benchmark qw{:all}; | |
use Carp; | |
my $str = "state declares a lexically scoped variable, just like my. However, those variables will never be reinitialized, contrary to lexical variables that are reinitialized each time their enclosing block is entered."; | |
my $len = length($str); |
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 Benchmark qw/:all :hireswallclock/; | |
use Math::BigFloat; | |
use Math::Pari; | |
my $count = shift || 10_000; | |
my $pressure_bf = Math::BigFloat->new(1011.4598); | |
my $pressure_pari = Math::Pari::PARI(1011.4598); |