Skip to content

Instantly share code, notes, and snippets.

Avatar
👶

taiyoh taiyoh

👶
View GitHub Profile
View ViewFunctions.pm
package MyApp::Web::ViewFunctions;
use Tiffany::Text::MicroTemplate::Extended;
package Tiffany::Text::MicroTemplate::Extended;
use strict;
use warnings;
sub c { Amon2->context }
View flymake-with-perl-carton.el
;; 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))
View RouterSimple.pm
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);
View test_controller_spec.rb
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
)
View util_transcation.js
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() {
View htpasswd.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
use Apache::Htpasswd;
use Term::ReadKey;
my $create;
View File.pm
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;
View archer-plugin-rsync.diff
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;
View test.pl
package Foo {
use IO::Prompt;
sub new { bless {}, shift }
sub ask {
my ($self, $msg) = @_;
my $echo = prompt("next: ");
print "You said '$echo'\n";
}
View archer-plugin-confirm.diff
--- 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 {