Skip to content

Instantly share code, notes, and snippets.

ruhenheim ruhenheim

  • Kumamoto
Block or report user

Report or block ruhenheim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ruhenheim
ruhenheim / basic_public_http_server_instance.tf
Created Jun 27, 2019
ec2(t3.micro)で外部公開httpサーバだけ立ち上げてみる
View basic_public_http_server_instance.tf
provider "aws" {
region = "ap-northeast-1"
}
data "aws_ami" "recent_amazon_linux_2" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
@ruhenheim
ruhenheim / explain_gsub_method.md
Created Jun 21, 2019
[Ruby]String#gsubメソッドについて
View explain_gsub_method.md

ヒアドキュメント表現

str = <<EOS
問い合わせの内容です。

改行もされています。
HTMLとしては改行コードを<br>要素などに置き換えて表現しないと期待する表示になりません。
EOS
@ruhenheim
ruhenheim / terraform_getting_started.md
Last active Jun 21, 2019
terraform 0.12 を使って はじめる ~ AWS Infrastructure as a Code
View terraform_getting_started.md

Terraform

Getting Started - AWS [using v0.12 or above]

terraform バイナリコマンドファイルをダウンロードし、PATHに追加

$ wget https://releases.hashicorp.com/terraform/0.12.2/terraform_0.12.2_linux_amd64.zip
$ unzip terraform_0.12.2_linux_amd64.zip
$ mkdir -p ~/.local/bin
@ruhenheim
ruhenheim / routes.rb
Last active Jun 19, 2019
Railsルーティング定義アレコレ
View routes.rb
Rails.application.routes.draw do
scope '(:locale)', locale: /#{I18n.available_locales.map(&:to_s).join('|')}/ do
# ====================================
# For API
# ====================================
namespace :api do
namespace :v1 do
resources :companies, path: 'cm/', only: [] do
resources :provinces, only: :index, defaults: { format: 'json' }
end
View check_mysql_socket.rb
def mysql_socket
@mysql_socket ||= [
"/tmp/mysql.sock", # default
"/var/run/mysqld/mysqld.sock", # debian/gentoo
"/var/tmp/mysql.sock", # freebsd
"/var/lib/mysql/mysql.sock", # fedora
"/opt/local/lib/mysql/mysql.sock", # fedora
"/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
"/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
"/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
View AWS Cloud9 MySQLバージョン5.5から5.7へのアップグレード手順.md

以下のコマンド操作を順に実施します。

1. 現状のMySQLバージョンを確認

$ mysql --version

2. 旧バージョン(5.5)パッケージ関連を削除

$ sudo yum -y remove mysql-config mysql55-server mysql55-libs mysql55
View rails_template_5.2
## https://techracho.bpsinc.jp/hachi8833/2017_02_16/32827
gem 'slim-rails'
gem 'seed-fu'
gem "aws-sdk-s3", require: false
gem 'image_processing'
gem 'ransack'
# gem 'bcrypt', '~> 3.1.7'
gem_group :development, :test do
gem 'rspec-rails', '~> 3.6.0'
@ruhenheim
ruhenheim / patch.20171012.diff
Created Oct 12, 2017
お気に入り動作が複数投稿があっても正常動作するまでに修正したパッチ
View patch.20171012.diff
diff --git app/controllers/goods_controller.rb app/controllers/goods_controller.rb
index 119862d..e4826ad 100644
--- app/controllers/goods_controller.rb
+++ app/controllers/goods_controller.rb
@@ -1,15 +1,12 @@
class GoodsController < ApplicationController
def create
- micropost = current_user.microposts.find_by(params[:content])
- good = current_user.goods.find_or_create_by(micropost_id: micropost.id)
- good.save
View campaigns.xml
<?xml version="1.0" encoding="UTF-8"?>
<VAST version="2.0">
<Ad>
<InLine>
<Creatives>
<Creative>
<Linear>
<Duration>00:00:15</Duration>
<MediaFiles>
<MediaFile delivery="progressive" type="video/mp4">
View kikuyo_budget.csv
date bucket count
2012-07-20 800 119
2012-07-20 900 123
2012-07-20 1000 173
2012-07-20 1100 226
2012-07-20 1200 284
2012-07-20 1300 257
2012-07-20 1400 268
2012-07-20 1500 244
You can’t perform that action at this time.