Skip to content

Instantly share code, notes, and snippets.

View yucao24hours's full-sized avatar
🎀
Learning DNS

Yuka Kato yucao24hours

🎀
Learning DNS
View GitHub Profile
@yucao24hours
yucao24hours / get_circleci_configs.rb
Last active July 2, 2020 02:55
Get .circleci/config.yml in each repository entire my company's org (to migrate CircleCI to GitHub Actions)
require 'octokit'
client = Octokit::Client.new(access_token: 'your_personal_access_token')
client.auto_paginate = true
File.open('configs.md', 'w') do |file|
repos = client.org_repos('awesome_org_name')
repos.each.with_index(1) do |repo, index|
puts "#{index}: #{repo[:name]}"
live_loop :flibble do
sample :bd_pure, rate: 1
sleep 0.5
end
play 70
sleep 0.5
play 72
sleep 0.5
play 74

追記

gem update コマンドに gem 名を渡さずそのまま実行すれば system のすべての gem が対象になる。

http://guides.rubygems.org/command-reference/#gem-update

もともと書いてたこと

cut コマンドは、指定した区切り文字・箇所からのデータを標準出力に表示する。

@yucao24hours
yucao24hours / double_quoted.rb
Last active October 21, 2016 08:54
データにダブルクオートがはいっていると Ruby が勝手にエスケープしてくれる https://tools.ietf.org/html/rfc4180
require "csv"
CSV.open("mogemoge.csv", "w+") do |csv|
array = %w(foo bar baz piyo)
double_quoted = array.map{|item| %Q|"#{item}"| }
p double_quoted
csv << double_quoted
end
@yucao24hours
yucao24hours / shiritorichan.gs
Last active May 6, 2016 12:21
Shiritorichan checks if the Shiritori word has been used in Slack channel.
var token = "<your_slack_token>";
var shiritori_channel = "<your_channel_id>";
var outgoing_token = "<your_outgoing_webhook_token>";
var bot_name = "shiritorichan";
function doPost(e) {
// To use `SlackApp` class, you need to activate SlackApp Library in Google Apps Script menu.
var app = SlackApp.create(token);
// Ignore the message posted by slackapp
機能 メソッド
単数形の名詞を複数形を変換する String#pluralize
複数形の名詞を単数形に変換する String#singularize
単語間を英大文字で区切った文字列をアンダースコア区切りに変換する(クラス名->ファイル名) String#underscore
アンダースコア区切りの文字列を英大文字区切り文字列に変換する(ファイル名->クラス名) String#camelcase
大文字区切り文字列を複数形のアンダースコア区切り文字列に変換する(クラス名->テーブル名) String#tableize
複数形のアンダースコア区切り文字列を大文字区切り文字列に変換する(テーブル名->クラス名) String#classify
クラス名からクラスそのものを得る String#constantize
@yucao24hours
yucao24hours / 20141026.md
Last active August 29, 2015 14:08
2014/10/26 Rails3 レシピブック読書会

範囲

p.49 025 コントローラ全体の共通のメソッドを追加する から

p.53 027 アクションの前または後にフィルタを適用する まで

helper_method

application_controller に helper_method 宣言をすると、そのメソッドはビューからも使えるようになる。

名前

かとうゆか(@yucao24hours)

職業

2011年にエンジニア人生をスタート。(当時は Java やら ActionScript やらを書いてた。)それまではフリーターしながらバンドやってました。エンジニアになるなんて思ってもなかった。

Ruby/Rails エンジニアとしては、2013年から働いています。

Ruby On Rails とわたし

ステータス : 3 (ほんば 🌿)

@yucao24hours
yucao24hours / self_introduction_yucato.md
Last active December 30, 2015 08:28
ゆかおの自己紹介です。

@yucato_ について

開発技術とのお付き合い歴

2011年にWebエンジニアに転身しました。 経験があるのは C, C++, Java, PHP だけど、ほとんど中途半端です。。 今年8月に Ruby をメインに使う会社に転職し、Rails を使ったプロジェクトで仕事をしています。

Ruby On Rails とわたし

Rails歴とよべるような期間は 3ヶ月ほど。 現在は仕事で使っているため さわらない日はありませんが、やっとキホンをわかってきたかなあ、くらいの認識です(>_<)

Githubとわたし

最近この よちよち.rbのために ものすごい勢いでGithubをさわる機会が増えたので、ちょっとずつ仲良くなれてきたかんじ :octocat: