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 data | |
| [ | |
| {x: :list, y:2, z: []}, | |
| {x: :item, y:3}, | |
| {x: :item, y:4}, | |
| {x: :list, y:5, z:[]}, | |
| {x: :item, y: 6}, | |
| {x: :item, y: 7}, | |
| {x: :banner, y: 8}, | |
| {x: :banner, y: 9} |
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 'active_support/all' | |
| data = [ | |
| {x: :list, y:2, z: []}, | |
| {x: :item, y:3}, | |
| {x: :item, y:4}, | |
| {x: :list, y:5, z:[]}, | |
| {x: :item, y: 6}, | |
| {x: :item, y: 7}, | |
| {x: :banner, y: 8}, |
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
| id=12345678900987654321 | |
| zcat action.log.gz | awk -v uid="$id" 'BEGIN{count=0;} {if($7 == "Kind:Mission" && $8 == "Action:Start" && $12 == "AccountID:uid") {count++;;}} END{print count}' |
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 | |
| version=`bundle --version | awk '{print $3}'` | |
| result=`echo "$version" |env ruby -n -e'puts Gem::Version.create("#{$_}") <=> Gem::Version.create("1.5.2")'` | |
| if [ $result -ge 0 ]; then | |
| echo true | |
| else | |
| echo false | |
| fi |
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 'bundler/setup' | |
| Bundler.require | |
| now = Time.parse('2014-02-04') | |
| file="action.#{now.strftime("%Y-%m-%d")}.log.gz" | |
| r = {} | |
| Zlib::GzipReader.open(file) do |gz| | |
| gz.each do|line| | |
| h = LTSV.parse(line.gsub(/\t\t/, "\t")).first | |
| Net::HTTP.post_form(URI.parse('http://127.0.0.1:8888/td.debug.account'), {'json'=> h.to_json}) |
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
| CSV.foreach(file, "CP932:UTF-8") | |
| CSV.open(file, "r", "CP932:UTF-8") #=> TypeError: no implicit conversion of String into Integer | |
| CSV.open(file, "r", encoding: "CP932:UTF-8") #=> OK |
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
| source "https://rubygems.org" | |
| gem "jruby-poi", github: "kameeoze/jruby-poi", require: "poi" | |
| gem "pry" | |
| gem "bundler", require: ['drb/drb', 'stringio'] |
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
| cronJob = require('cron').CronJob | |
| module.exports = (robot) -> | |
| # *(sec) *(min) *(hour) *(day) *(month) *(day of the week) | |
| new cronJob('0 */10 * * * *', () -> | |
| robot.send {room: process.env.HUBOT_CAMPFIRE_ROOMS}, "current time is #{new Date()}." | |
| ).start() |
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
| module.exports = (robot) -> | |
| robot.hear /デプロイします/, (msg) -> | |
| msg.send "OKです" |
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
| # A sample Gemfile | |
| source "https://rubygems.org" | |
| gem "clockwork" | |
| gem "hipchat" |