Skip to content

Instantly share code, notes, and snippets.

View gist:9289192
#!/usr/bin/env ruby
REPOS_DIR = File.expand_path('~/repos')
owner_and_repo, * = *ARGV
clone_dir = File.join(REPOS_DIR, '@' + owner_and_repo)
if FileTest.directory?(clone_dir)
abort "#{owner_and_repo} is already cloned"
end
View brew-tap-repository
#!/bin/sh
set -ue
if [[ $# -le 0 ]]; then
cat <<ERROR 1>&2
Usage:
$(basename $0) TAP_OWNER/TAP_REPO
ERROR
exit 1
fi
View 00_main.pl
#!/usr/bin/env perl
use strict;
use warnings;
use cartonup;
use Plack;
View _usage.rb
using AntiString
puts !"和尚" # -> 尚和
View gist:e3bd73d5018784fefd64
package t::constraints;
use strict;
use warnings;
use FormValidator::Lite::Constraint;
use Test::More;
rule VALUES => sub {
diag explain +{
'$_' => +{
View context.t.pl
use strict;
use warnings;
use Test::More;
sub detect_context {
my $is_wantarray;
return \$is_wantarray, sub { $is_wantarray = wantarray };
}
subtest 'list context' => sub {
View conjunction.js
function logicalConjunction (criteria) {
return criteria.reduce(function (f, g) {
return function () { return f.apply(this, arguments) && g.apply(this, arguments) };
});
}
View tree-builder-select.pm
use strict;
use warnings;
use Test::More;
use HTML::TreeBuilder::Select;
my $HTML = <<EOF;
<header id="header"></header>
EOF
my $tree = HTML::TreeBuilder::Select->new;
$tree->parse_content($HTML);
View html-tree_builder-select.t
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Section::Simple qw( get_data_section );
use HTML::TreeBuilder::Select;
use HTML::Selector::XPath qw( selector_to_xpath );
use Test::More;
my $tree = HTML::TreeBuilder::Select->new();