Code Archive Skip to content Google About Google Privacy Terms
© Thiemo Mättig, created in September 2007 More JavaScript experiments »
1 以下、名無しにかわりましてVIPがお送りします :2008/09/28(日) 11:51:10.26 ID:p7Drb4kC0
以下のエントリで質問を頂いたので http://d.hatena.ne.jp/amachang/20080827/1219815788 以下のコード x + a - (x % a || a) やりたいこと a で x を丸めること こんな感じ function round(a) { return function(x) { return x + a - (x % a || a); } } var round10 = round(10); round10(10); // 10 round10(15); // 20 round10(20); // 20 round10(25); // 30 もっといい方法あるかなあ (function(b) { return b ? x - b : x; })(x % a) うーん どっちにしろ奇麗には書けないなあ
Firefox3.5+Safari4+Chrome2+Opera10.6+Edge79+Edge (Legacy)12+Internet Explorer10+Firefox Android?Safari iOS5+Chrome Android?WebView Android?Samsung Internet?Opera Android11+ 10.1 Introduction 10.1.1 Scope This section is non-normative. This specification defines an API for running scripts in the background independently of any user interface scripts. This allows for long-running scripts that are no
The secret is out since yesterday: Google has released Google Chrome - a new webbrowser. It's easy to install - and from a first impression also very fast. But that's not the exciting news - at least not for us Smalltalkers. The most interesting part is a new implementation for the JavaScript Engine called "V8" done by members of the orginal Animorphic team. Animorphic Smalltalk was a Smalltalk sy
WEBに掲載する以上、画像をローカルに保存されると言う事は仕方が無い事だと言う認識が主流だとは思いますが、それは避けたい、あまり保存されたくないと思っている方にオススメなのが、今回紹介するJavaScript「dwProtector」です。 dwProtectorは「右クリックによる名前をつけて保存」「ドラッグ&ドロップで保存」「右クリックで名前をつけて背景を保存」「背景画像を表示」からの画像保存をプロテクトしてくれます。 詳しくは以下 導入方法は至って簡単で、「dwProtector.js」を読み込んで、以下のようにクラスを指定してあげれば、空白のgif画像が画像の変わりにダウンロードされるようになります。 window.addEvent(‘domready’, function() { var protector = new dwProtector({ image: ‘/blank.g
「ウチのワカイシがやっていること」で紹介したシステムを公開しました。 http://www.microapplications.net/ http://www.microapplications.net/download.html から libwcc-js-0.01.zip をダウンロードすると、そのなかに通信ライブラリが入っています。この通信ライブラリで、他のブラウザやサーバー側機能(Junctools)と通信ができます。 いまのところ、サンプルが2つしかなくて(随時追加予定)、お決まりのHelloWold(http://www.microapplications.net/trac.cgi/wiki/HelloWorld)、それと、別プラウザにalertを出すRemoteAlert(http://www.microapplications.net/trac.cgi/wiki/Remote
Xmpp4Js is an XMPP client library written in pure Javascript. It connects to a server using BOSH (XEP-0124, 0206) Binding or Script Syntax. HTTP Binding This method uses XmlHttpRequests to get and receive packets from a BOSH implementation on the same domain as the connecting site. The only way to run in BOSH mode is to serve your site from the same domain as the BOSH implementation (same-origin p
Directing JavaScript with Arrows (Functional Pearl) Khoo Yit Phang Michael Hicks Jeffrey S. Foster Vibha Sazawal University of Maryland, College Park {khooyp,mwh,jfoster,vibha}@cs.umd.edu Abstract JavaScript, being a single-threaded language, makes extensive use of event-driven programming to enable responsive web applica- tions. However, standard approaches to sequencing events are messy, and of
関西での JavaScript 勉強会、Kanasan.JS #2 に行ってきました。今回は 9 時から 21 時という長丁場で、内容は前回に引き続き Prototype.js のコードリーディング。ただし、前回はバージョン 1.5.1.1 だったのが今回からは 1.6.0 を使用ということで、コードリーディングに先駆けて 1.6.0 での変更点に関するプレゼンテーションをやらせていただきました。他の参加者の方々のレポートなどは Kanasan さんの記事経由で読めるかと思います。 フリートーク 午前中はフリートーク及びプレゼンテーションということで、自己紹介の後雑多な話題に。 リファレンス どんな参考文書を利用しているかという話題。とりあえずググって出てきたページという方が結構いるようです。私も検索エンジンを使ったりもしますが、特定のサイトだとこんな感じです。 コア言語 ECMAScri
Javascriptを使い始めたばかりの太郎君に、上司の花子さんから「スタイルシート用のスタイル名をDOMからアクセス可能なプロパティ名に変更するJavascriptのライブラリを作って欲しい」という課題が与えられました。何のことか分からずにポカンとしている太郎君に、花子さんは「"font-style" を"fontStyle"に変更する関数を作ればいいのよ」と言い残して立ち去ってしまいます。 O'ReillyのJavascript本としばらく格闘した太郎君は、やっとライブラリを完成させます。 function capitalize(str) { return str.charAt(1).toUpperCase(); } function style2prop(str) { return str.replace(/-[a-z]/g, capitalize); } "font-style"が
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く