Skip to content

Instantly share code, notes, and snippets.

View taiyoh's full-sized avatar
👶

taiyoh taiyoh

👶
View GitHub Profile
package MyApp::Web::ViewFunctions;
use Tiffany::Text::MicroTemplate::Extended;
package Tiffany::Text::MicroTemplate::Extended;
use strict;
use warnings;
sub c { Amon2->context }
;; via http://d.hatena.ne.jp/trotr/20090822/1250958096
;; ------------------------------------------------
(require 'cl)
(defun myenv-string-join (sequence separator)
(mapconcat #'identity sequence separator))
(defsubst myenv-parent-dir (path)
"return parent directory path of argument."
(substring-no-properties (file-name-directory path) 0 -1))
package Amon2::Web::Dispatcher::RouterSimple;
use strict;
use warnings;
use Router::Simple 0.03;
sub import {
my $class = shift;
my %args = @_;
my $caller = caller(0);
@taiyoh
taiyoh / test_controller_spec.rb
Created December 25, 2012 01:25
facebook絡みの動作をテストする ref: http://qiita.com/items/53fafc145f7c496c301d
before(:all) do
# DatabaseClearnerを使ってDBを初期化
DatabaseClearner.clean
# テストユーザ作成のためのインスタンスをつくる
@test_users = Koala::Facebook::TestUsers.new(
:app_id => OmniAuthConfig::FACEBOOK_API_KEY,
:secret => OmniAuthConfig::FACEBOOK_SECRET_API_KEY
)
var $ = require('jquery-deferred');
function transaction(conn, callback) {
var d = $.Deferred();
d.done(function() {
conn.query('COMMIT');
}).fail(function() {
conn.query('ROLLBACK');
});
conn.query('START TRANSACTION', function() {
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
use Apache::Htpasswd;
use Term::ReadKey;
my $create;
package Archer::Plugin::File;
use strict;use warnings;
use base qw( Archer::Plugin );
use File::Spec;
use FindBin;
sub run {
my ($self, $context, $args) = @_;
my $f = File::Util->new;
diff --git a/lib/Archer/Plugin/Rsync.pm b/lib/Archer/Plugin/Rsync.pm
index c2f943c..1eebd23 100644
--- a/lib/Archer/Plugin/Rsync.pm
+++ b/lib/Archer/Plugin/Rsync.pm
@@ -44,8 +44,8 @@ sub run {
$rsync->exec;
- $self->log( debug => $rsync->out ) if $rsync->out;
- $self->log( debug => $rsync->err ) if $rsync->err;
package Foo {
use IO::Prompt;
sub new { bless {}, shift }
sub ask {
my ($self, $msg) = @_;
my $echo = prompt("next: ");
print "You said '$echo'\n";
}
--- a/lib/Archer/Plugin/Confirm.pm
+++ b/lib/Archer/Plugin/Confirm.pm
@@ -2,7 +2,7 @@ package Archer::Plugin::Confirm;
use strict;
use warnings;
use base qw/Archer::Plugin/;
-use IO::Prompt;
+use IO::Prompt::Simple;
sub run {