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
| fk82% ruby -v | |
| ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0] | |
| fk82% irb -rredis | |
| irb(main):001:0> Redis::VERSION | |
| => "3.0.7" | |
| irb(main):002:0> redis = Redis.new(host: 'fe80::1%lo0') | |
| => #<Redis client v3.0.7 for redis://fe80::1%lo0:6379/0> | |
| irb(main):003:0> irb(main):003:0> redis.get 'foo' | |
| Users/fukayatsu/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/redis-3.0.7/lib/redis/connection/ruby.rb:129: [BUG] rb_sys_fail_str(connect(2) for [fe80::1%lo0]:6379) - errno == 0 | |
| ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.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
| google: https://www.google.co.jp/search?q=%s&safe=off | |
| translate: | |
| alc: http://eow.alc.co.jp/search?q=%s | |
| yahoo: | |
| image: | |
| all: http://image.search.yahoo.co.jp/search?ei=UTF-8&fr=top_ga1_sa&p=%s | |
| a: | |
| b: | |
| c: | |
| d: |
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
| # 知見 - 登録されるとつらいユーザー名リスト - Qiita http://qiita.com/phimcall/items/4c559b70f70ea7f1953b | |
| require 'reserved_string' | |
| ReservedString.configure do |config| | |
| config.strip_string = true # default | |
| config.use_default_list = true # default | |
| config.lists = { | |
| your_list: %w(foo bar baz), | |
| another_list: %w(hoge piyo), | |
| } |
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
| $('img[src$=movable_face.gif]').attr('src', 'http://0.gravatar.com/avatar/ada5318ef6bfb0f5e5a0bf8ada8f9cbc') |
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
| #!/bin/bash | |
| # Usage | |
| # 1. setup camera module and make it enabled | |
| # 2. install ImageMagick | |
| # 3. create generic webhook on idobata.io | |
| # 4. add `0,30 10-23 * * * /home/pi/snap.sh` to crontab | |
| raspistill -t 1 -o /home/pi/tmp/pic.jpg -w 200 -h 150 -q 80 | |
| convert -colorspace gray -sketch 0x20+135 /home/pi/tmp/pic.jpg /home/pi/tmp/pic_mod.jpg |
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
| require 'esa' | |
| require 'json' | |
| require 'pp' | |
| class Importer | |
| def initialize(client, file_path) | |
| @client = client | |
| @items = JSON.parse(File.read(file_path)) | |
| end | |
| attr_accessor :client, :items |
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
| def A(o) | |
| p "A "+o.s | |
| end | |
| class Happy | |
| def initialize(s) | |
| @s=s | |
| end | |
| def s |
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
| fs = require 'fs' | |
| {print} = require 'util' | |
| {spawn} = require 'child_process' | |
| build = (callback) -> | |
| coffee = spawn 'coffee', ['-c', '-o', 'lib', 'src'] | |
| coffee.stderr.on 'data', (data) -> | |
| process.stderr.write data.toString() | |
| coffee.stdout.on 'data', (data) -> |
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
| ### | |
| 前提: | |
| 必要なパッケージ | |
| npm install -g coffee-script | |
| npm install -g jasmine-node | |
| ディレクトリ構成 | |
| /src #*.coffee | |
| /lib #*.js | |
| /spec #*.spec.coffee | |
| ### |
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
| describe 'tree', -> | |
| describe 'キーにコロンを含まないとき', -> | |
| it 'そのままのオブジェクトが返ってくること', -> | |
| expect({'a': 1}).toEqual {a: 1} | |
| expect({'a': 1,'b': 2}).toEqual {a:1, b:2} | |
| describe 'キーがコロンでセパレートされているとき', -> | |
| it '階層化されて返ってくること', -> | |
| expect( tree {'a:b':1, 'c:d':2} ).toEqual {a:{b:1},c:{d:2}} | |
| expect( tree {'a:b:c':1, 'a:b:d':2} ).toEqual {a:{b:{c:1, d:2}}} |
OlderNewer