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
use 5.010; | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use Marpa::R2 2.082000; | |
my $input = <<'END_OF_STRING'; | |
{ | |
name => 'test hash 1', |
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 Mojolicious::Lite; | |
use MongoDB; | |
use MongoDB::OID; | |
my $mongo_port = shift || 27017; | |
helper 'mongo' => sub { | |
my ($self, $name) = @_; | |
my $host = 'localhost:' . $mongo_port; |
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 perl6 | |
# see: | |
# * http://transfixedbutnotdead.com/2010/01/13/anyone_for_metaprogramming/ | |
# * http://transfixedbutnotdead.com/2010/01/14/anyone-for-perl-6-metaprogramming/ | |
# * http://fingernailsinoatmeal.com/post/292301859/metaprogramming-ruby-vs-javascript | |
# * http://transfixedbutnotdead.com/2010/10/31/perl6-metaprogramming-update/ | |
# below runs on Rakudo Star (2010.10 release). |
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 perl6 | |
use v6; | |
my $article_template = slurp("templates/post.html"); | |
my $default_template = slurp("templates/default.html"); | |
my $root_url = "http://strangelyconsistent.org/blog"; | |
my @monthnames = <Jan Feb Mar Apr | |
May Jun Jul Aug | |
Sep Oct Nov Dec>; |
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
p <- ggplot(mtcars, aes(factor(cyl),mpg, | |
fill=factor(cyl), | |
colour=factor(cyl))) | |
p1 <- p+geom_violin(alpha=0.3, width=0.5) + | |
geom_boxplot(width=0.2, outlier.colour=NA) | |
p2 <- p+geom_violin(alpha=0.3, width=0.5) + | |
geom_dotplot(binaxis='y', stackdir='center', dotsize=0.5) | |
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
import com.cloudera.crunch._ | |
import com.cloudera.scrunch._ | |
class ScrunchWordCount { | |
def wordCount(inputFile: String, outputFile: String) = { | |
val pipeline = new Pipeline[ScrunchWordCount] | |
pipeline.read(from.textFile(inputFile)) | |
.flatMap(_.toLowerCase.split("\\W+")) | |
.filter(!_.isEmpty()) | |
.count |
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
;; echowuhao's solution to Intro to Vectors | |
;; https://4clojure.com/problem/6 | |
:a :b :c |
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
(ns potato.core | |
(:use [slingshot.slingshot :only [throw+ try+]]) | |
(:use [clojure.string :only [trim split]])) | |
;; use this provide template values at write time (i.e. not compile time). | |
;; "name" will be the name of the template variable. "context", when not nil, | |
;; will be the value previously returned by *template-value* for the enclosing | |
;; section. | |
(defn ^:dynamic *template-value* [name context]) |
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
with(x, { | |
f(z) | |
}) | |
# Which of the following statements is this equivalent to? | |
# | |
# a) x$f(x$z) | |
# b) f(x$z) | |
# c) x$f(z) | |
# d) f(z) |
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
use strict; | |
use warnings; | |
use DateTime; | |
my $dt = DateTime->new( | |
day => 13, | |
year => 2012, | |
); | |
my $count = 0; |
OlderNewer