Skip to content

Instantly share code, notes, and snippets.

View gist:22763
Index: ext/nkf/nkf-utf8/nkf.c
===================================================================
--- ext/nkf/nkf-utf8/nkf.c (revision 20127)
+++ ext/nkf/nkf-utf8/nkf.c (working copy)
@@ -33,7 +33,7 @@
***********************************************************************/
#define NKF_IDENT "$Id$"
#define NKF_VERSION "2.0.8"
-#define NKF_RELEASE_DATE "2008-10-28"
+#define NKF_RELEASE_DATE "2008-11-07"
View emphasize.js
/* 強調タグを追加 */
function emphasizeWord(word) {
return '<strong>' + word + '</strong>';
}
/* 長い順に並べるための比較関数 */
function compareLengthDecrease(a, b) {
a = a.length;
b = b.length;
return a > b ? -1 : a < b ? 1 : 0;
View gist:79019
ALLOW_TAGS = %w/font span p b br/
def validate_xml_fragment
str = self
tags = str.scan(/\G(?:(<[^<>]+>)|[^<>&]+|[^&<>]*(?:&#?\w+;[^&<>]*)+)/)
return ERB::Util.html_escape(str) unless $'.empty?
stack = []
tags.each do |tag|
case tag.first
when /<(\w+)(?: +\w+=(?:"[^"]*"|'[^']*'|\w+))* *(\/)?>/
return ERB::Util.html_escape(str) unless ALLOW_TAGS.include?($1)
View gist:83836
r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED)
(?<json> \g<object> | \g<array> ){0}
(?<begin-array> \g<ws> \[ \g<ws> ){0}
(?<begin-object> \g<ws> \{ \g<ws> ){0}
(?<end-array> \g<ws> \] \g<ws> ){0}
(?<end-object> \g<ws> \} \g<ws> ){0}
(?<name-separator> \g<ws> : \g<ws> ){0}
(?<value-separator> \g<ws> , \g<ws> ){0}
(?<ws> [\x20\t\n\r]* ){0}
(?<value> false | null | true | \g<object> | \g<array> | \g<number> | \g<string> ){0}
@nurse
nurse / twitterbot.nb
Created Apr 13, 2009
twitter bot for nadoka
View twitterbot.nb
# -*-ruby-*-
#
# Acknowledgement
# @ko1_twitter
# http://uno.ac/d/20070727.html
# http://iseebi.half-done.net/diary/?date=20070417#p01
# http://mono.kmc.gr.jp/~yhara/d/?date=20070421#p02
# http://www.rubyist.net/~nobu/t/20051013.html#p02
require 'cgi'
require 'net/http'
@nurse
nurse / gist:213354
Created Oct 19, 2009
Xi Bot for nadoka
View gist:213354
#
# Xi Bot
#
# No rights reserved.
#
# Synopsis:
# xi> 2d10 (two dice of ten)
# [2d10] 13 = 7 + 6
# xi> 5d
# [5d6] 14 = 3 + 1 + 3 + 1 + 6
@nurse
nurse / gist:259236
Created Dec 18, 2009
MarldiaBot for nadoka
View gist:259236
# -*-ruby-*-
require 'cgi'
require 'net/http'
require 'rexml/document'
require 'uri'
require 'time'
class MarldiaBot < Nadoka::NDK_Bot
def bot_initialize
@chats = @bot_config.fetch(:chats, nil)
View forked_initial_thread-pt_lid.patch
Index: lib/libpthread/pthread.c
===================================================================
RCS file: /cvsroot/src/lib/libpthread/pthread.c,v
retrieving revision 1.106.2.2
diff -u -p -r1.106.2.2 pthread.c
--- lib/libpthread/pthread.c 11 Jan 2010 00:47:29 -0000 1.106.2.2
+++ lib/libpthread/pthread.c 8 Feb 2010 22:59:19 -0000
@@ -261,6 +261,8 @@ pthread__child_callback(void)
* much. Anything that permits some pthread_* calls to work is
* merely being polite.
@nurse
nurse / merger.rb
Created Jun 5, 2010
Merger for Ruby
View merger.rb
#! /bin/ruby
# http://coderepos.org/share/browser/docs/shyouhei/ruby%20development/merger.rb
require 'date'
require 'tempfile'
$repos = 'svn+ssh://svn@ci.ruby-lang.org/ruby/'
ENV['LC_ALL'] = 'C'
def help
@nurse
nurse / abnf2onig.rb
Created Mar 30, 2011
ABNF to Oniguruma Regexp Converter
View abnf2onig.rb
#!/usr/local/bin/ruby
# If you want an ABNF to Regexp, see below.
# http://www.a-k-r.org/abnf/
# https://github.com/martinthomson/abnf2regex
require 'strscan'
RULENAME_ = /[A-Za-z][A-Za-z0-9\-]*/
C_WSPP_ = /[ \t]+(?:(?:;.*)?\n[ \t]+)*|(?:(?:;.*)?\n[ \t]+)+/
C_WSPS_ = /[ \t]*(?:(?:;.*)?\n[ \t]+)*/
C_NL_ = /(?:;.*)?\n/
You can’t perform that action at this time.