tmp
Monday, March 31, 2014
AngularJS 用のブックマーク
* project作成のためのtemplate
* Service, Factory, Providerの違い
* Service, Factory, Provider, Value, Constantの違い
AngularJS プロジェクト作成メモ(bower, grunt, yeoman)
```shell # install npm modules $ npm install -g bower grunt-cli yo $ npm install -g generator-angular # update gem, and install compass $ gem update --system $ gem install compass # create project dir $ mkdir example $ cd example # setup project by yeoman $ yo angular # or yo angular --minsafe ?? # start server $ grunt serve # test $ grunt test # build $ grunt build # dir for publish $ ls dist ``` ###参考 *
Tuesday, March 25, 2014
diff関連
###svn diff でタブ、スペースを無視して比較する場合 $ svn diff --diff-cmd diff -x "-BbwE" FILES ###revision間のsvn st $ svn diff --summarize -r xxx:yyy
Thursday, March 13, 2014
選択範囲の取得
JavaScriptで選択範囲の取得をするのには `window.getSelection` か `document.selection` を使用して ```javascript function getSelectionText(){ if (window.getSelection) { return window.getSelection().toString(); } else if (document.selection) { return document.selection.createRange().text; } return null; } ``` とすれば良いが IE10,11とFF?では対象のelementがinput=text, textareaの場合にwindow.getSelectionで取得できないので考慮する (IE10ならdocument.selectionがまだ使えるのでそれで取得してもいいけど微妙) ```javascript function getSelectionText(){ if (window.getSelection && document.activeElement){ var userSelection; if (document.activeElement.nodeName == "TEXTAREA" || (document.activeElement.nodeName == "INPUT" && document.activeElement.getAttribute("type").toLowerCase() == "text")){ var ta = document.activeElement; userSelection = ta.value.substring(ta.selectionStart, ta.selectionEnd); } else { userSelection = window.getSelection(); } return userSelection.toString(); } else if (window.getSelection) { return window.getSelection().toString(); } else if (document.selection) { return document.selection.createRange().text; } return null; } ``` ###参考 * http://forums.mozillazine.org/viewtopic.php?f=25&t=2268557
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)