log.metatype

Archive for September 2007

require

YUILoaderを参考にして、
外部JavaScriptファイルをJavaScriptから読込む方法が分かったので、
該当部分だけスニペットにしておこう。

Snipplrrequire

Posted by inamorix on September 27th, 2007

  1. function require (js) {
  2.         var d    = document;
  3.         var el   = d.createElement('script');
  4.         var head = d.getElementsByTagName('head')[0];
  5.        
  6.         el.src  = js;
  7.         el.type = 'text/javascript';
  8.         head.appendChild(el);
  9. }

document.writeで<script>要素を出力する方法は、
ページ読込み完了後には使えないので、
この場合、document.body.appendChildだと思っていたけど、
Safariで効かないので、ずっと無理だと勘違いしていた。

<head>要素にappendChildはSafariでもOKなんだ。
これでブックマークレットなど、色々と応用できそう。

Snipplr WordPress Plugin

さて、理解不足の英語に苦戦する日々が続いていたけど、
ブログらしく細々と書き始めてみよう。

Snipplrは、お気に入りのコード共有サービス。
なかなかうまく活用する方法が思い付かなかったけど、
Snipplr WordPress PluginというWordPress用のプラグインがあったので、
組込んでブログと連携してみる事にした。
スニペットとブログのそれぞれの更新を分離できるので、
これから活用してみよう。

こんな感じでブログ側に引っ張れる。

Snipplrbind

Posted by inamorix on May 30th, 2007

  1. Function.prototype.bind = function (obj) {
  2.         var fn = this;
  3.         return function () {
  4.                 var args = [this];
  5.                 for (var i = 0, ix = arguments.length; i < ix; i++) {
  6.                         args.push(arguments[i]);
  7.                 }
  8.                 return fn.apply(obj, args);
  9.         };
  10. };

あと、TextMateTextMate Bundleを組み合せるのも、
スニペットをダイレクトに呼び出せて便利。

mad template ver 1.01 released

I supported configuration file of new version 1.3.1a.
And it’s changed design a little (more smart).

New version of the JsDoc Toolkit is very nice!
“-c” option in particular.


» The mad template

test test @ Del.icio.us Pop.ulo.us

Del.icio.us Pop.ulo.us is the list of popular sites and users on Del.icio.us.
I started a test record.


» Del.icio.us Pop.ulo.us

ports.js ver 1.01 released

The bug fix of the Lightbox error on “fetch”.
And “fetch” files moved to the Amazon S3.


@bugfix


» The ports.js