Skip to content

Instantly share code, notes, and snippets.

View gist:5071145
$ find local/lib/perl5 -name "README.pod"
local/lib/perl5/App/README.pod
local/lib/perl5/LWP/UserAgent/DNS/README.pod
local/lib/perl5/Test/Deep/README.pod
local/lib/perl5/Test/Fake/README.pod
View gist:4128761

TODO

  • (/) suite hooks
    • before(:suite)
    • after(:suite)
  • (/) skip some conditions
    • xit
    • it 'SPECIFICATION ONLY'
  • tagged example
  • it 'SPEC' => { ENV_FOO => 1 } => sub { ... };
@masaki
masaki / gist:3698917
Created Sep 11, 2012 — forked from cfcosta/gist:1149139
Implementation of Webrat's #table_at for using with Capybara. Not the cleanest implementation ever, but it works correctly.
View gist:3698917
def table_at(selector)
Nokogiri::HTML(page.body).css(selector).map do |table|
table.css('tr').map do |tr|
tr.css('td').map { |td| td.text.strip }
end
end[0].reject(&:empty?)
end
View gist:3115702
$ cpanm Net::SSLeay IO::Socket::SSL Test::SharedFork Test::TCP
Net::SSLeay is up to date. (1.48)
IO::Socket::SSL is up to date. (1.76)
Test::SharedFork is up to date. (0.20)
Test::TCP is up to date. (1.16)
@masaki
masaki / gist:3111860
Created Jul 14, 2012
SSL certificate
View gist:3111860
mkdir -p demoCA/newcerts
touch demoCA/index.txt
echo "01" >> demoCA/serial
openssl req -new -x509 -keyout cakey.pem -out cacert.pem -days 36000
openssl rsa -in cakey.pem -out cakey.pem
openssl req -new -keyout server-key.pem -out server-req.pem -days 36000
openssl rsa -in server-key.pem -out server-key.pem
openssl ca -policy policy_anything -in server-req.pem -cert cacert.pem -keyfile cakey.pem -out server-cert.pem -days 36000
View gist:2578828
RC_FILE=$HOME/.bashrc
echo "insecure" >> $HOME/.curlrc
ruby -e "$(curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
curl -fksSL install.perlbrew.pl | bash
curl -fksSL get.rvm.io | bash -s stable
echo "source $HOME/perl5/perlbrew/etc/bashrc" >> $RC_FILE
echo "source $HOME/.rvm/scripts/rvm" >> $RC_FILE
@masaki
masaki / gist:2518883
Created Apr 28, 2012
capybara selenium scripting
View gist:2518883
#!/usr/bin/env ruby
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
Capybara.run_server = false
Capybara.default_driver = :selenium
include Capybara::DSL
View recent_job_detector.pl
#!/usr/bin/env perl
use strict;
use warnings;
use String::CamelCase qw(decamelize);
use Getopt::Long;
use List::MoreUtils qw(uniq);
GetOptions('a|app=s', \my $app);
@masaki
masaki / webapp.psgi
Created Jan 28, 2012
Jenkins WebHook Receiver (w/ Jenkins Notification Plugin's JSON)
View webapp.psgi
#!/usr/bin/env perl
use strict;
use warnings;
use Plack::Request;
use HTTP::Status qw(:constants status_message);
use JSON qw(from_json);
use LWP::UserAgent;
sub to_psgi_res {
View gist:1569791
#!/bin/sh
if [ -f perlbrew/perl ]; then
perlbrew use `cat perlbrew/perl`
fi
if [ -f carton.lock ]; then
if [ -d local/cache ]; then
carton install --cached --deployment
else