Skip to content

Instantly share code, notes, and snippets.

View ryuone's full-sized avatar

Ryuichi Maeno ryuone

View GitHub Profile
@ryuone
ryuone / sinonJSCodeReading.org
Created May 27, 2012 09:16
Sinon.js Code Reading(mid-flow)

sinon.js

private variable
sinon用非公開変数群
  1. div documentオブジェクトが定義されていれば、document.createElementで div要素を作成する。
  2. hasOwn Object.prototype.hasOwnPropertyを参照する。
  3. sinon 外部に公開するオブジェクト
    • function
@ryuone
ryuone / jsTestDriver.conf
Created May 20, 2012 01:57
jsTestDriverのサンプルコード
server: http://localhost:4224
load:
- lib/*.js
- src/*.js
- test/*.js
@ryuone
ryuone / lib.scss
Created May 19, 2012 17:02
scss multi browser setting
@charset "utf-8";
@mixin vpcss($key, $val){
-webkit-#{$key}: $val;
-moz-#{$key}: $val;
-ms-#{$key}: $val;
-o-#{$key}: $val;
#{$key}: $val;
}
@ryuone
ryuone / phantom-sample.js
Created May 19, 2012 02:04
phantom-sample.js
var page = new WebPage(),
url = 'http://www.yahoo.co.jp';
page.open(url, function (status) {
if (status !== 'success') {
console.log('Unable to access network');
} else {
var results = page.evaluate(function() {
var list = document.querySelectorAll('a'), pizza = [], i;
for (i = 0; i < list.length; i++) {
http://stackoverflow.com/questions/300855/looking-for-a-better-javascript-unit-test-tool
http://d.hatena.ne.jp/goyoki/20100223/1266939139
http://d.hatena.ne.jp/babie/20100226/1267158419
http://d.hatena.ne.jp/Yoshiori/20100224/1267015034
http://cjohansen.no/talks/2011/xp-meetup/#1
http://cjohansen.no/talks/2011/javabin-s/#1
http://cjohansen.no/talks/2011/busterjs/#1
http://azu.github.com/slide/Kamakura/busterJS.html#slide1
@ryuone
ryuone / sample.dart
Created October 11, 2011 16:20
dart sample
main(){
var xxx = {'one':1, "two":2}; // key must be string.
print(xxx["one"]); // NG : xxx.one
print(xxx['two']);
var a,b=100;
final f = 20;
print(a);
print(b);
// f = 100; // error
@ryuone
ryuone / curry.dart
Created October 11, 2011 16:18
dirt curry
main(){
curry(Function fun, carried) => (param) { fun(carried, param); };
greet(String greeting, String name) => print(greeting + " " + name);
var hi = curry(greet, "Hi!! ");
hi('ryuone.');
}
@ryuone
ryuone / .htaccess
Created August 12, 2011 06:52
mod_rewrite(.htaccess)の設定
#
# Apacheのモジュール mod_rewriteを有効にする。(Ubuntu:sudo a2enmod rewrite)
#
RewriteEngine on # 1)
RewriteRule ^([0-9\-]+)\.html$ index.fcgi?date=$1 # 2)
#
# http://www.ryuone.com/diary/20110806.html
# でアクセスした場合、2)で
# http://www.ryuone.com/diary/index.fcgi?date=20110806
@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')});
@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()),