Skip to content

Instantly share code, notes, and snippets.

View sunny4381's full-sized avatar

NAKANO Hideo sunny4381

  • 株式会社ウェブチップス
View GitHub Profile
data:text/html,<html contenteditable> <script>window.onbeforeunload=function(){ return "%E9%96%89%E3%81%98%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F" }</script>
# SHIRASAGI OAuth 2.0 IdP 機能を利用したサンプルコード
# このサンプルでは authorization code flow を用います。
#
# 実行方法
# bin/rails runner oauth2_sample_with_authorization_code_flow.rb
# ドメイン
your_domain = "https://localhost:3551/"
# 認可エンドポイントの URL
authorize_url = URI.join(your_domain, "/.mypage/login/oauth2/authorize")
# SHIRASAGI OAuth 2.0 IdP 機能を利用したサンプルコード
# このサンプルでは implicit flow を用います。
#
# 実行方法
# bin/rails runner oauth2_sample_with_implicit_flow.rb
# ドメイン
your_domain = "https://localhost:3551/"
# 認可エンドポイントの URL
authorize_url = URI.join(your_domain, "/.mypage/login/oauth2/authorize")
# SHIRASAGI OAuth 2.0 IdP 機能を利用したサンプルプログラム
# このサンプルでは jwt 拡張フローを用います。
#
# 実行方法
# bin/rails runner oauth2_sample_with_jwt_flow.rb
# ドメイン
your_domain = "https://localhost:3551/"
# トークンエンドポイントの URL
token_url = URI.join(your_domain, "/.mypage/login/oauth2/token")
#
# 使用方法:
# bundle exec rails runner all_contents_download.rb www > all_contents.csv
#
site = Cms::Site.find_by(host: ARGV[0])
exporter = Cms::AllContent.new(site: site)
enumerable = exporter.enum_csv(encoding: "Shift_JIS")
enumerable.each do |csv|
STDOUT.write csv