Skip to content

Instantly share code, notes, and snippets.

@masaki
masaki / gist:3698917
Created September 11, 2012 14:17 — forked from cfcosta/gist:1149139
Implementation of Webrat's #table_at for using with Capybara. Not the cleanest implementation ever, but it works correctly.
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
@masaki
masaki / gist:4128761
Created November 22, 2012 00:51
Test::Ika

TODO

  • (/) suite hooks
    • before(:suite)
    • after(:suite)
  • (/) skip some conditions
    • xit
    • it 'SPECIFICATION ONLY'
  • tagged example
  • it 'SPEC' => { ENV_FOO => 1 } => sub { ... };
$ 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
use OAuth::Lite::Consumer;
use Furl 2.08;
my $oauth = OAuth::Lite::Consumer->new(
ua => Furl->new(keep_request => 1),
);
my %args = (
method => 'POST',
url => 'http://example.com/oauth',
  • carton install -f /path/to/cpanfile
  • enable to specify "carton bundle" cache path
  • move 02packages from .cpan/ to cache path
  • enable "via" in cpanfile
requires 'carton',
    via => 'git://github.com/masaki/carton.git',
    commitish => 'devel';
Can't convert 'Module::CPANfile::Requirement=HASH(0x96855c8)': Invalid version format (non-numeric data)
! Couldn't find module or a distribution Amon2::Lite~Module::CPANfile::Requirement=HASH(0x8f3a910) ()
@masaki
masaki / setup_perl.sh
Last active January 4, 2016 18:59
setup languages
#!/bin/bash
[ -e "$HOME/.plenv" ] && rm -rf $HOME/.plenv
git clone [email protected]:tokuhirom/plenv.git $HOME/.plenv
echo '[ -d "$HOME/.plenv/bin" ] && [ `echo $PATH | grep "$HOME/.plenv/bin"` ] || export PATH="$HOME/.plenv/bin:$PATH"' >> $HOME/.zshrc
echo 'if which plenv > /dev/null; then eval "$(plenv init -)"; fi' >>$HOME/.zshrc
mkdir -p $HOME/.plenv/plugins
git clone [email protected]:tokuhirom/Perl-Build.git $HOME/.plenv/plugins/perl-build
package Test::mysqld::Persistent;
use strict;
use warnings;
use Test::mysqld;
use JSON;
use File::Spec;
sub new {
my ($class, %args) = @_;
@masaki
masaki / make_sandbox_from_installed_64bit.patch
Created February 26, 2014 11:53
MySQL::Sandbox make_sandbox_from_installed 64bit patch
diff --git a/bin/make_sandbox_from_installed b/bin/make_sandbox_from_installed
index 7b3b5d8..47976c0 100755
--- a/bin/make_sandbox_from_installed
+++ b/bin/make_sandbox_from_installed
@@ -98,8 +98,13 @@ for my $prefix (@prefixes) {
{
$found_install_db =1;
}
- if ( glob("$prefix/lib/mysql/libmysqlclient*")
- or glob( "$prefix/lib/libmysqlclient*") ) {
desc 1 before all
cont 1 before all
desc 1 before each
cont 1 before each
exam 1 before
exam 1 after
cont 1 after each
desc 1 after each
cont 1-1 before all
desc 1 before each