"【告知】"がウザいという人がいるらしい。
自分でフィルタするか、removeしろよっていうのもアレかなと思ったので使い捨てGM。
// ==UserScript== // @name Twittfilter // @namespace http://d.hatena.ne.jp/send/ // @description twitter filter // @include http://twitter.com/* // ==/UserScript== // (function (){ var filter = function(nodes) { var f = { anouncement : function (context){ var path = '//td[@class="content"]/span[@class="entry-title entry-content"]'; var elems = document.evaluate(path, context, null, 7, null); var regex = /^\s*【告知】/; for(var e = 0 ; e < elems.snapshotLength; e++) { var elem = elems.snapshotItem(e); var s = elem.firstChild.data; if(s != null && regex.test(s)) elem.style['display'] = 'none'; } }, }; for each (var node in nodes) for each (var func in f) func(node); } filter([document]); if(typeof window.AutoPagerize != 'undefined') window.AutoPagerize.addFilter(filter); })();
不安になるコード
これで動くと思ってなかった。試してみて怖くなった。
<?Php ECHO "aaaaaaa\n"; function FoobAr() { return "foobar\n"; } eChO fOOBaR(); //=> foobar IF(true) echo "true\n"; claSs Aaa { public staTic function dump() { echo "aaa\n"; } pubLic funCtion doDump() { echo "!!!!!\n"; } } AaA::Dump(); AAA::DumP(); $Obj = new AaA(); $obj = nEw AaA(); $obj->DODUMP();
一括実行系ななにか
分散系のこと考えてた時に出来たなにか
<?php class LumpedCollection { protected $_container = array(); protected $_method_cache = array(); protected $_class_name; public function __construct(array $objs = null) { if($objs === null || count($objs) == 0) return; $this->_class_name = get_class($objs[0]); $this->_container = $objs; } public function append(stdClass $obj) { $obj_class = get_class($obj); if($this->_class_name == null) $this->_class_name = $obj_class; else if ($obj_class !== $this->_class_name) throw new InvalidArgumentsException(); $this->_container[] = $obj; } public function __call($name, $args) { $method = (isset($this->method_cache[$name])) ? $this->method_cache[$name] : $this->method_cache[$name] = new ReflectionMethod($this->_class_name,$name); $results = array(); foreach($this->_container as $obj) { $instance = ($method->isStatic()) ? null : $obj; $result = $method->invokeArgs($instance, $args); $results = $this->merge_result($result, $results); } return $results; } protected function merge_result($result, $results) { if ($result !== null && is_array($result)) $results = array_merge($results,$result); else $results[] = $result; return $results; } } class LumpedCollectionTest extends stdClass { private static $value = "aaa"; private $foo; public function setFoo($value) { $this->foo = $value; return true; } public static function getValue() { return self::$value; } public function getFoo() { return $this->foo; } public function getHash() { return array('hoge' => 1,'hage' => 2, 'var' => array(1,2)); } public function getArray() { return array(1,2); } } $container = new LumpedCollection(); $container->append(new LumpedCollectionTest()); $container->append(new LumpedCollectionTest()); $container->append(new LumpedCollectionTest()); $container->append(new LumpedCollectionTest()); $ret = $container->setFoo("foo"); print_r($ret); $ret = $container->getValue(); print_r($ret); $ret = $container->getFoo(); print_r($ret); $ret = $container->getArray(); print_r($ret); $ret = $container->getHash(); print_r($ret);
Firefox + Firebug + Google Adsense におけるクラッシュ問題について
id:RAVERAVER:20071013 の 人に聞かれたので、 Firebug ML 読み直しました。
ML で、 John J Barton 氏 の発言を中心に見た限りでは、こういう感じなのかな?
原因
- Google Adsense の問題
- Script を Create したり、 Destroy したりしすぎ
- イベント毎に大きな script 読み込みすぎ
- 結果として warning が多すぎる
- Firefox 側の問題
- script.functionSource のバグ
暫定的対応策
- 攻撃的対応
- about:config の javascript.options.strict を false
- デフォルトは、 false だけど、 true だと更に warning が出るからマズそう
- Firebug 1.1.0b3 以降に、バージョン上げて、Firebug->Script->Option->DecompileScriptsForSource のチェック外す
- about:config の javascript.options.strict を false
- 守備的対応
John 曰く
- 数日内に、1.1.0b5 出すから、それが上手く問題解決出来るといいなあ…
- あんまり大きな声では言えないけど、今回は運悪く、こういう warning 絡みのことで、色々あったけど、普通の JavaScript プログラマにとっては、 javascript.options.strict って、凄くためになるんだけどなあ…
Mozilla24 出張Shibuya.jsでjQueryの話をしました。
反省点とか。
資料
- ものすごく適当なツールなので、buggyです。
- クリックで次のページに進みます。連打すると変なことがあるかもです。
- http://blog.linkthink.co.jp/doc/k.sakai/mozilla24/20070915/
追記:
いぬビームの発言は半分捏造です。twitterでそういうことは言ってません。(会社で同じニュアンスのことは言ってたけど。)
Port801セキュリティ勉強会の資料
箇条書きテキストしか用意していなかった。超適当
Webアプリケーションセキュリティ初歩の初歩 〜はまちやの傾向と対策〜
- はじめに
- Sessionの取り扱い
- その他の脆弱性
- ちょうIE対策!