This file contains 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 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 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 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 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 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 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
IDENTIFICATION DIVISION. | |
PROGRAM-ID. DSP001. | |
PROCEDURE DIVISION. | |
DISPLAY "Hello World" | |
STOP RUN. |
This file contains 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
# ruby-1.9.3 | |
item_count, campaign_count = gets.chomp.split(' ').map(&:to_i) | |
items = item_count.times.map { gets.chomp.to_i } | |
campaigns = campaign_count.times.map { gets.chomp.to_i } | |
sums = [] | |
items.each.with_index do |item_a, i| | |
items[0...i].each do |item_b| | |
sums << (item_a + item_b) |
This file contains 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 blog() { | |
cd /Users/fukayatsu/github/fukayatsu.github.io | |
if [ $1 ] | |
then | |
file=$(bundle exec middleman article $1 | \ | |
grep 'create\|update' | \ | |
awk '{print $3}') | |
url=$(echo $file | \ | |
sed -e 's/source\/posts/http:\/\/fk.dev/' | \ |
This file contains 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
#################### helpers | |
def _gem(gem_info) | |
if gem_info.is_a? String | |
gem gem_info | |
elsif gem_info.is_a? Array | |
gem *gem_info | |
end | |
end |