Skip to content

Instantly share code, notes, and snippets.

@miyohide
miyohide / Gemfile
Created May 7, 2022
Cloud Native Buildpacks for Ruby
View Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
ruby "3.1.2"
gem "sinatra"
gem "puma"
View rails7_help.txt
Usage:
rails new APP_PATH [options]
Options:
[--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated engines)
[--skip-collision-check], [--no-skip-collision-check] # Skip collision check
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/miyohide/.rbenv/versions/3.1.1/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
@miyohide
miyohide / feed.builder
Created May 31, 2020
create Atom feed for middleman
View feed.builder
---
layout: false
---
require 'open3'
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.title "Sample Site"
xml.link "href" => "http://example.com"
xml.updated Time.now
View branch_strategy.md

これはなにか

Gitブランチ戦略のメモです。

基本戦略

ファーストバージョンリリースまで

  • masterブランチに対して直接コミットを行う。
  • ここで言うファーストバージョンとは、アプリ全体が一通り揃った段階の状態を指す。世間にリリースしているかどうかは不問。
@miyohide
miyohide / rails_new_version_6.0.0.txt
Created Oct 29, 2019
Rails new -h result. rails -v = 6.0.0
View rails_new_version_6.0.0.txt
Usage:
rails new APP_PATH [options]
Options:
[--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications)
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /usr/local/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
@miyohide
miyohide / frequently_use_git_commands.md
Last active Nov 25, 2020
よく使うGitコマンド
View frequently_use_git_commands.md

マージ済みのブランチ(現在のブランチ、develop、master以外)を表示する

git branch --merged | egrep -v '*|develop|master'

マージ済みのブランチ(現在のブランチ、develop、master以外)を削除する

git branch --merged | egrep -v '*|develop|master' | xargs git branch -d

既にリモートで削除されているブランチを消す

View SampleGame.java
package com.github.miyohide;
public class SampleGame {
public String play(String p1, String p2) {
if ((p1.equals("rock") && p2.equals("scissors")) ||
(p1.equals("scissors") && p2.equals("paper"))
) {
return "player1Win";
}
View a.rb
require "minitest/autorun"
require "json"
def solve(src)
src_i = src.to_i(16)
out = []
1.upto src_i do |i|
if (src_i & i ) == i
out << i
end
View pukiwiki2md.rb
class Pukiwiki2md
STRONG_REG = /''(.+?)''/
LINK_REG = /\[\[(.+?):(.+?)\]\]/
def convert_strong!(line)
line.gsub!(STRONG_REG, "**\\1**")
line
end
def convert_link!(line)
View id_match.rb
Issue = Struct.new(:id, :name)
Note = Struct.new(:id, :issue_id, :name)
issue1 = Issue.new(1, "aaa")
issue2 = Issue.new(2, "bbb")
note1_1 = Note.new(1, 1, "note1-1")
note1_2 = Note.new(2, 1, "note1-2")
note2_1 = Note.new(3, 2, "note2-1")