Skip to content

Instantly share code, notes, and snippets.

@syohex
syohex / 22_ruby.el
Created July 4, 2012 15:11
yari-helm instead of yari-anything
(defvar yari-helm-source-ri-pages
'((name . "RI documentation")
(candidates . (lambda () (yari-ruby-obarray)))
(action ("Show with Yari" . yari))
(candidate-number-limit . 300)
(requires-pattern . 2)
"Source for completing RI documentation."))
(defun yari-helm (&optional rehash)
(interactive (list current-prefix-arg))
@syohex
syohex / unagi.pl
Created July 5, 2012 01:50
うなぎ食べたい
#!perl
use strict;
use warnings;
sub unagi_nqueen {
my $n = shift;
my $answer = [];
_nqueen([], $n, 0, $answer);
_unagi_filter($n, $answer);
@syohex
syohex / get_methods_list.pl
Created July 7, 2012 14:12
Benchmark to getting methods list between Class::Inspector and Class::MOP::Class
#!perl
use strict;
use warnings;
use Class::Inspector;
use Moose;
use LWP::UserAgent;
use Benchmark qw/cmpthese/;
@syohex
syohex / output.log
Created July 7, 2012 14:35
Get Perl module methods from Emacs Lisp
ELISP> (pcomp:get-methods "Data::MessagePack")
("Data::MessagePack::utf8" "Data::MessagePack::unpack" "Data::MessagePack::true" "Data::MessagePack::prefer_integer" "Data::MessagePack::pack" "Data::MessagePack::new" "Data::MessagePack::get_utf8" "Data::MessagePack::get_prefer_integer" "Data::MessagePack::get_canonical" "Data::MessagePack::false" "Data::MessagePack::encode" "Data::MessagePack::decode" "Data::MessagePack::canonical" "Data::MessagePack::bootstrap" "Data::MessagePack::CLONE")
@syohex
syohex / mycandidates.txt
Created July 7, 2012 14:50
Create list of perldoc candidates
Acme::Jiro
Acme::MomoiroClover
Algorithm::Diff
Amon2
Amon2::DBI
Amon2::Plugin::LogDispatch
Amon2::Plugin::Web::MobileAgent
Any::Moose
AnyEvent
AnyEvent::FriendFeed::Realtime
@syohex
syohex / output.log
Created July 8, 2012 01:14
Show module methods which are specified by ARGV
% ./print_methods.sh Moose Furl Text::Xslate
Moose::after
Moose::around
Moose::as
Moose::augment
Moose::before
Moose::blessed
Moose::bootstrap
Moose::class_type
@syohex
syohex / zsh_weather.sh
Created July 12, 2012 12:09
Visualize current repository is clean or not clean
## show git branch at right prompt
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]'
precmd () {
psvar=()
LANG=en_US.UTF-8 vcs_info
is_fine=0
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
function git_is_rebasing() {
local topdir=$(git rev-parse --show-toplevel 2>/dev/null)
if [ $? -eq 0 ]; then
if [ -d $topdir/.git/rebase-merge ]; then
echo "$ZSH_THEME_GIT_PROMPT_REBASING"
fi
fi
}
@syohex
syohex / notification_sample.el
Created July 19, 2012 15:15
Sample of notifications.el
(require 'notifications)
(notifications-notify :title "hoge" :body "fuga")
@syohex
syohex / popup-cascade-sample.el
Created July 25, 2012 08:02
Sample program of popup-cascade-menu
(require 'popup)
(defun cui-about (user)
(with-temp-buffer
(let* ((url (format "http://cui-about.me/%s" user))
(cmd (format "curl %s" url))
(ret (call-process-shell-command cmd nil t nil)))
(unless (= ret 0)
(error (format "Failed: %s" cmd)))
(goto-char (point-min))