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 'open-uri' | |
require 'json' | |
require 'active_support/core_ext' | |
require 'sinatra' | |
RSS_FEED_URL = 'http://jigokuno.com/?mode=rss' | |
get '/' do | |
open(RSS_FEED_URL) do |rss_feed| | |
Hash.from_xml(rss_feed.read).to_json |
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 'open-uri' | |
require 'json' | |
require 'nokogiri' | |
JSON_FEED_URL = 'http://localhost:4567/' | |
list = Array.new | |
open(JSON_FEED_URL) do |json_feed| | |
json = JSON.parse(json_feed.read) | |
json['RDF']['item'].each do |item| |
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 'faraday' | |
require 'json' | |
require 'yaml' | |
require 'pry' | |
require 'pp' | |
Setting = YAML.load_file './main.yml' | |
Setting['ChatWork']['OrderTemplate'] = Setting['ChatWork']['OrderTemplate'] + Setting['ChatWork']['PairOrderTemplate'].combination(2).collect {|arr| arr.join(",") } |
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
tail -f hoge.log | ruby -ne '$_.match(/(tracking_id)":"([^"]+)/) {|m| p "#{m[1]} => #{m[2]}" }' |
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
# 参照 | |
params = { aaa: 123 } | |
copy_params = params | |
copy_params[:bbb] = 456 | |
p params | |
# dup | |
params = { aaa: 123 } | |
copy_params = params.dup | |
copy_params[:bbb] = 456 |
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
php -r "readfile('https://getcomposer.org/installer');" | php | |
php composer.phar require guzzlehttp/guzzle | |
php composer.phar require bugsnag/bugsnag | |
``` | |
require 'vendor/autoload.php'; | |
$bugsnag = Bugsnag\Client::make($_ENV['BUGSNAG_API_KEY']); | |
$bugsnag->setReleaseStage('development'); | |
$bugsnag->notifyException(new RuntimeException("Test error"));" | |
``` |
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 'uri' | |
require 'pry' | |
require 'csv' | |
require 'time' | |
REPRODUCE_HOST = 'localhost:4567' | |
PROTOCOL = 'http' | |
CURL_COMMAND = 'curl' | |
def main |
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
module SlackHelper | |
extend ActiveSupport::Concern | |
# メッセージを通知します | |
def self.send_to_slack(message, channel:, mentions: nil, icon: ':fukurouchan:') | |
mentions_line = SlackHelper.create_mentions_line(mentions) | |
SlackHelper.send_core(mentions_line + message, channel, icon_emoji: icon) | |
end | |
delegate :send_to_slack, to: SlackHelper |
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/sh | |
private_key_path=$1 | |
insert_file_path=$2 | |
environment_path=$3 | |
if [ ${environment_path} = '/home/ec2-user/circuit-x-batch-dev' ]; then | |
echo '[[[ 開発環境に向いています ]]]' | |
batch_server_ip_address=3.112.22.21 | |
else |
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
db = Sequel.mysql2(ApplicationRecord.connection_config) | |
# media_daily_referrer_campaign_report | |
Benchmark.bm do |x| | |
# 1. sequel | |
# 1-1. idのみ | |
x.report('sequel(id) ') do | |
db.fetch('select id from media_daily_referrer_campaign_reports limit 50000'){|r| r[:id] } | |
end |
OlderNewer