Skip to content

Instantly share code, notes, and snippets.

View ryuone's full-sized avatar

Ryuichi Maeno ryuone

View GitHub Profile
@ryuone
ryuone / gist:817647
Created February 9, 2011 00:50
JavaScript new Method like Ruby
Function.prototype.new = function(){
return new this;
}
function Super(){
this.ver='Super 0.1';
return this;
}
Super.prototype.now = function(){
return (new Date()).getTime();
@ryuone
ryuone / getImages.js
Created April 4, 2011 12:52
Node.js program. parseHTML and get Image files to save it.
/* node getImages.js http://www.yahoo.co.jp */
var htmlparser = require('htmlparser');
var sys = require('sys');
var http = require('http');
var fs = require('fs');
var url = require('url');
var path = require('path');
if(process.argv.length !== 3){
@ryuone
ryuone / getElementsByNamev1.html
Created April 7, 2011 11:20
IE9RCのdocument.getElementsByNameの挙動がおかしい。
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<title>getElementsByName</title>
</head>
<body>
<!-- IE9RC : すべてlengthは1が返ってくる。 -->
<!-- Firefox : すべてlengthは0が返ってくる。 -->
<a id='aname' onclick="alert(document.getElementsByName('aname').length)">clickme(a)!!</a>
@ryuone
ryuone / data.js.diff
Created May 6, 2011 15:26
jQuery data.js diff from 1.5.2 to 1.6
diff --git a/src/data.js b/src/data.js
index 2d53a71..c2fd558 100644
--- a/src/data.js
+++ b/src/data.js
@@ -1,6 +1,7 @@
(function( jQuery ) {
-var rbrace = /^(?:\{.*\}|\[.*\])$/;
+var rbrace = /^(?:\{.*\}|\[.*\])$/,
+ rmultiDash = /([a-z])([A-Z])/g;
@mixin vpcss($key, $val){
-moz-#{$key}: $val;
-webkit-#{$key}: $val;
-o-#{$key}: $val;
-ms-#{$key}: $val;
#{$key}: $val;
}
body{
margin: 0 auto;
@ryuone
ryuone / p_div.html
Created May 19, 2011 02:21
a > divは駄目?
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.js'></script>
<title>a &gt; div</title>
</head>
<body>
<article class="section">
<p>
@ryuone
ryuone / tdiary.rb.diff
Created May 24, 2011 22:44
tDiaryのHTML5対応
diff --git a/tdiary.rb b/tdiary.rb
index dcdb458..edae6ac 100644
--- a/tdiary.rb
+++ b/tdiary.rb
@@ -1078,6 +1078,8 @@ module TDiary
end
@io = @conf.io_class.new( self )
+ @headerfile = "header.rhtml"
+ @footerfile = "footer.rhtml"
<!DOCTYPE html>
<html>
<head>
<title>coffee-script</title>
<script src='coffee-script.js' type='text/javascript'></script>
<script src='./sampleA.coffee' type='text/coffeescript'></script>
</head>
<body>
<div></div>
</body>
@ryuone
ryuone / node-v8-compiler.cc.diff
Created July 28, 2011 02:55
Node(0.4.10等)をデバッグモード(--debug --gdb)でconfigureし、コンパイルしたときのエラー対処
diff --git a/deps/v8/src/compiler.cc b/deps/v8/src/compiler.cc
index 18f54c2..b4d20f1 100755
--- a/deps/v8/src/compiler.cc
+++ b/deps/v8/src/compiler.cc
@@ -800,7 +800,7 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
}
}
- GDBJIT(AddCode(name,
+ GDBJIT(AddCode(Handle<String>(shared->DebugName()),
@ryuone
ryuone / compareDocumentPosition.html
Created August 1, 2011 16:57
about compareDocumentPosition
<!DOCTYPE html>
<html>
<head>
<title>mouseenter/mouseleave</title>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js'></script>
<script>
$(function(){
// withinElementでは無く、deleteを呼び出すようになるため、#dv31/#div32に移動した際にもイベントが発生する。
//$('#dv2').bind('mouseenter', {selector: $("#dv31").get(0)}, function(e){console.log('mouseenter dv2')});
//$('#dv2').bind('mouseleave', {selector: $("#dv32").get(0)}, function(e){console.log('mouseleave dv2')});