- reflog(参照ログ)とは HEAD やブランチ先端の動きの履歴
- 各個人のローカルリポジトリに存在
- ブランチの切り替え、新たに加えられた変更のプル、履歴の書き換え、あるいは単なる新規コミットの実行などを記録
git reflogで HEAD の移動履歴を、git reflog <ブランチ名>でそのブランチ先端が指していたコミットの一覧を確認可能HEAD@{5}: HEAD の五つ前の状態を示す
This file contains hidden or 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
| package isbn; | |
| import java.util.regex.Pattern; | |
| /** | |
| * ISBN class. | |
| */ | |
| public class Isbn { | |
| /** Number of digits in ISBN. */ | |
| public static final int LENGTH = 13; |
This file contains hidden or 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
| initializer 'watch_open_api_docs' do |app| | |
| app.reloaders << app.config.file_watcher.new([], { Rails.root.join('open_api_docs').to_s => ['yml'] }) | |
| config.to_prepare do | |
| yaml = YamlRefResolver.new.resolve!(Rails.root.join('open_api_docs', 'index.yml')).to_yaml | |
| Tempfile.create do |f| | |
| OpenApiParser::Specification.resolve!(f.path) | |
| end | |
| rescue JsonSchema::Error => e | |
| Rails.logger.error e.full_message | |
| end |
This file contains hidden or 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 'yaml' | |
| doc = YAML.parse(STDIN).to_ruby | |
| doc['definitions'].transform_values! { |schema| schema.merge('additionalProperties' => false) } | |
| puts doc.to_yaml |
This file contains hidden or 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
| include_recipe 'selinux::disabled' | |
| package 'epel-release' | |
| package 'gcc' | |
| package 'gcc-c++' | |
| package 'git' | |
| package 'libyaml-devel' | |
| package 'nginx' | |
| package 'openssl-devel' | |
| package 'postgresql-contrib' |
This file contains hidden or 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
| { | |
| "env": { | |
| "node" : true, | |
| "browser" : true, | |
| "es6": true | |
| }, | |
| "ecmaFeatures" : { | |
| "jsx": true, | |
| }, | |
| "plugins": [ |
This file contains hidden or 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
| curl の気持ちになって gist を POST |
This file contains hidden or 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
| def my_permutation(sequence, r = nil) | |
| r = sequence.size if r.nil? || sequence.size < r | |
| result = [] | |
| enumerate(sequence, r, [], result) | |
| result | |
| end | |
| def enumerate(sequence, r, one_enumeration, result) | |
| if one_enumeration.size == r | |
| result << one_enumeration.dup |
This file contains hidden or 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
| class Walker | |
| Position = Struct.new(:x, :y) | |
| MAP = [['a', 'b', 'c', 'd'], ['e', 'f', 'g', 'h'], ['i', 'j', 'k', 'l'], ['m', 'n', 'o', 'p']] | |
| def initialize(tiles) | |
| @current = Position.new(1, 0) | |
| @previous = nil | |
| @from = nil | |
| @tiles = tiles.split('/').map { |l| l.split('') } | |
| end |
This file contains hidden or 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 HookMethod | |
| def hook_method(hook, *methods) | |
| methods.each do |method| | |
| orig = "#{method}_without_logging".to_sym | |
| if instance_methods.include?(orig) | |
| raise NameError, "#{orig} isn't a unique name" | |
| end | |
| alias_method orig, method |
NewerOlder