Skip to content

Instantly share code, notes, and snippets.

NARUSE, Yui nurse

Block or report user

Report or block nurse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View static-check.rb
#!ruby
if false
class C
def m
xxxx
end
end
def mm
yyyy
View xmllexer.rb
require 'nokogiri'
# XMLLexer - SAX with scanner like API
class XMLLexer
def initialize(path)
@f = Fiber.new do
parser = Nokogiri::HTML::SAX::Parser.new(DocProxy.new)
parser.parse_file(path)
raise EOFError
end
View chkbuild.sh
#!/bin/sh
# https://gist.github.com/nurse/6101638
export U=naruse
export PUBKEY_URL=http://nalsh.jp/ssh.pub
## before running this script
### Debian
# edit /etc/network/interfaces with dns-nameservers
# sudo aptitude update && sudo aptitude safe-upgrade
@nurse
nurse / gist:5027888
Last active Dec 14, 2015
僕の考えた最強の Binary Pack 仕様
View gist:5027888

僕の考えた最強の Binary Pack 仕様

追加する format

  • annotation
  • bignum (多倍長整数)
  • decimal
  • rational
  • raw inf (64でいい?)
  • array inf (64でいい?)
@nurse
nurse / gist:5002610
Last active Dec 14, 2015
常識の無いメイド卿に贈るやっておくべきエロゲ百選
View gist:5002610

常識の無いメイド卿に贈るやっておくべきエロゲ百選

(製作中です)

elf

  • EVE
  • YU-NO

Leaf

@nurse
nurse / thread_stack_pcs.patch
Created Feb 5, 2013
A patch for darwin's Libc-825.25, which fixes a bug that backtrace(3) doesn't work if it is called from signal handler when it uses alternate signal stack. http://www.opensource.apple.com/source/Libc/Libc-825.25/gen/thread_stack_pcs.c
View thread_stack_pcs.patch
--- gen/thread_stack_pcs.c.orig 2013-02-04 15:51:02.000000000 +0900
+++ gen/thread_stack_pcs.c 2013-02-05 14:45:47.000000000 +0900
@@ -37,6 +37,7 @@
#endif
#define INSTACK(a) ((a) >= stackbot && (a) <= stacktop)
+#define INALTSTACK(a) ((a) >= altstackbot && (a) <= altstacktop)
#if defined(__ppc__) || defined(__ppc64__) || defined(__x86_64__)
#define ISALIGNED(a) ((((uintptr_t)(a)) & 0xf) == 0)
#elif defined(__arm__)
@nurse
nurse / gist:4324519
Last active Feb 28, 2018
ぼくの考えた最強のRuby新機能案
View gist:4324519

ぼくの考えた最強のRuby新機能案

野心的な新機能案や、互換性等の理由でおよそ採用されないであろう夢を書き連ねています。

Remove Fixnum and Bignum

Fixnum と Bignum を削除して、Integer クラスに統合する。両者は Flonum のように内部的に切り替えられる。

1 / 2 is Rational

Integer#/ の結果を Rational で返すようにする。 https://bugs.ruby-lang.org/issues/5512#change-37021

View gist:4274272

Requirements of the Ruby Standard Specification

Patch Level

The spec defines behavior of each release versions like 1.9.2, 1.9.3, 2.0.0. It mustn't see patch level.

Implementation Defined Behavior

Implementations have some their specific features like objspace, RubyVM, TracePoint of MRI.

@nurse
nurse / gist:3015253
Last active Feb 23, 2017
プログラミングを悟るための公案集
View gist:3015253

プログラミング公案集

「公案」とは禅で用いられ、なんたら かんたら。 この公案を考えることでオブジェクト指向プログラミングの悟りをなんたらかんたら。

変数

  • Q: 変数とは何か?
  • A: 箱である
  • B: ラベルである
@nurse
nurse / gist:2779978
Created May 24, 2012
chkbuild用config.ru for sqale
View gist:2779978
class Rack::File
alias _serving serving
def serving(env)
_serving(env).tap do |status, headers, body|
path = env['PATH_INFO']
if path.end_with?('/rss')
headers["Content-Type"] = 'application/rss+xml'
elsif path.end_with?('.gz')
headers["Content-Type"] = Rack::Mime.mime_type(::File.extname(path[0..-4]), 'text/plain')
headers["Content-Encoding"] = 'gzip'
You can’t perform that action at this time.