Skip to content

Instantly share code, notes, and snippets.

diff -up ruby-1.9.2-p290/ruby.c filter-ruby-1.9.2-p290/ruby.c
--- ruby-1.9.2-p290/ruby.c 2010-12-23 19:49:13.000000000 +0900
+++ filter-ruby-1.9.2-p290/ruby.c 2011-10-28 21:50:44.452623054 +0900
@@ -1618,7 +1618,16 @@ load_file_internal(VALUE arg)
return (VALUE)rb_parser_compile_string(parser, fname, f, line_start);
}
rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
- tree = rb_parser_compile_file(parser, fname, f, line_start);
+ {
+ VALUE source_filter = rb_intern("source_filter");
@emasaka
emasaka / 0001-expand-t.co.patch
Created October 3, 2011 04:31
make earthquake.gem to expand t.co URL (third party patch)
From de5e8c5038751a105a089b030716c883d8842758 Mon Sep 17 00:00:00 2001
From: emasaka <[email protected]>
Date: Fri, 30 Sep 2011 20:46:49 +0900
Subject: [PATCH 1/2] expand t.co
---
lib/earthquake/output.rb | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/lib/earthquake/output.rb b/lib/earthquake/output.rb
package Plagger::Plugin::CustomFeed::Config;
use strict;
use base qw( Plagger::Plugin );
use DirHandle;
use Encode;
use File::Spec;
use List::Util qw(first);
use Plagger::Date; # for metadata in plugins
use Plagger::Util qw( decode_content );
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
use Encode;
use PDF::API2;
my $pdf = PDF::API2->open($ARGV[0]) or die;
for my $p (1 .. $pdf->pages) {
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
SOURCE = 'http://httpd.apache.org/docs/2.2/mod/quickreference.html'
DEST = 'apache.dict'
list = []
open(SOURCE) do |io|
(defun visual-sleep-sort (lst)
(save-window-excursion
(let (r)
(with-temp-buffer
(switch-to-buffer (current-buffer))
(dolist (i lst)
(princ (format "%s%d\n" (make-string i ?\ ) i) (current-buffer)) )
(while (> (buffer-size) 0)
(beginning-of-buffer)
(while (not (eobp))
bash-4.2の新機能について、bash-4.1のリリースからの変更を簡単に説明します。完全な説明は、いつものとおりマニュアルページ (doc/bash.1) で読めます。
1. bashの新機能
a. 実行権限があり#!で始まらないシェルスクリプトにおいて、`exec -a foo'で$0に`foo'が設定されるようになりました。
b. コマンド置換やシェル関数によるサブシェルや、サブシェル中の組み込みコマンドは、新しくトラップを設定しなければ、トラップ文字列を再設定しないようになりました。これにより、$(trap)が呼び出し元のトラップを表示することと、新しいトラップが設定されるまでトラップ文字列が残ることを認めます。
c. `trap -p'はシェルの起動時に無視するよう設定されて性質を変更できないシグナルを表示するようになりました。
# plugin for earthquake.gem
Earthquake.init do
command :line do
puts '-' * (ENV['COLUMNS'].to_i - 1)
end
end
preexec() {
_preexec_cmd=$1
}
precmd() {
(bijo-linux-notify "$_preexec_cmd" &)
}
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::UserAgent;
use File::Spec::Functions;
use Gtk2::Notify -init, 'Bijo Linux Notify';
sub notify_send {
my ($title, $icon) = @_;
Gtk2::Notify->new($title, '', $icon)->show;