- JavaScriptモジュールをダウンロード、管理するプログラム。
- JavaScript版のBundlerみたいな感じ。
- node.jsが必要
- 似たプロダクトの中では、軽量な管理ツールらしい。(競合はComponentやBrowserify)
- ダウンロードするだけ。モジュールの配備はしない。
- require() は提供しない。htmlから
<script src="bower_component/jquery/dist/jquery.js">みたいにする必要がある。 - ファイルの配備をしない。bower_component/jquery/dist/jquery.js みたいなファイルにアクセスする必要がある。配備をするには他のツールと連携する必要あり。(grunt-bower-taskを使うなどすればいいらしい。 http://yosuke-furukawa.hatenablog.com/entry/2013/06/04/085537)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.ajaxSetup({ | |
| beforeSend: function(xhr, settings) { | |
| if (settings.type == 'POST' || settings.type == 'PUT' || settings.type == 'DELETE') { | |
| if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) { | |
| // Only send the token to relative URLs i.e. locally. | |
| xhr.setRequestHeader("X-CSRF-Token", $('meta[name="csrf-token"]').attr('content')); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### sample1 | |
| Kernel.private_instance_methods.grep /hoge/ # => [] | |
| Object.private_instance_methods.grep /hoge/ # => [] | |
| self.private_methods.grep /hoge/ # => [] | |
| self # => main | |
| self.class # => Object | |
| def hoge | |
| 'moge' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### sample1 | |
| Kernel.private_instance_methods.grep /hoge/ # => [] | |
| Object.private_instance_methods.grep /hoge/ # => [] | |
| self.private_methods.grep /hoge/ # => [] | |
| self # => main | |
| self.class # => Object | |
| def hoge | |
| 'moge' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding: utf-8 -*- | |
| require 'curses' | |
| def main | |
| Curses.init_screen | |
| @map = [ | |
| [0, 0, 0, 0, 0], | |
| [0, 1, 1, 1, 0], | |
| [0, 1, 1, 1, 0], | |
| [0, 1, 1, 1, 0], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "hello, ruby" # => "hello, ruby" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding: utf-8 -*- | |
| require 'curses' | |
| def main | |
| Curses.init_screen | |
| begin | |
| @y = Curses.lines / 2 | |
| @x = Curses.cols / 2 | |
| while true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding: utf-8 -*- | |
| class BlankSlate < BasicObject | |
| def method_missing(name, *args) | |
| "BlankSlate##{name} called" | |
| end | |
| def respond_to?(name) | |
| name.to_s == 'hoge' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding: utf-8 -*- | |
| def main | |
| Module.nesting # => [] | |
| c = A::B::C.new | |
| c.b_method | |
| c.c_method | |
| end | |
| module A |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function peco_and_writeback() { | |
| BUFFER=$($LBUFFER | peco) | |
| CURSOR=$#BUFFER | |
| zle -R -c | |
| } | |
| zle -N peco_and_writeback | |
| bindkey '^K' peco_and_writeback |