This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 Model < ActiveRecord::Base | |
has_many :users | |
def as_json(options={}) | |
super.as_json(options).merge({users: self.users}) | |
end | |
end |
This file contains 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 ErrorsController < ActionController::Base | |
NOT_FOUND = 404 | |
STANDARD_ERROR = 500 | |
rescue_from StandardError, with: :error_500 | |
rescue_from AbstractController::ActionNotFound, with: :render_404 | |
rescue_from ActionController::RoutingError, with: :render_404 | |
layout false |
This file contains 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
gem 'newrelic_rpm' |
This file contains 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 HogeModel | |
# fugaにマッチしたカラムの返却 | |
def fuga_columns | |
self.attributes.keys.select { |a| a.match(/fuga/) } | |
end | |
end |
This file contains 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
# 暗号モード: ECB | |
# パディング方式: PKCS5Padding | |
# OpenSSL::Cipher.ciphers で利用可能な暗号方式名を取得可能 | |
# https://docs.ruby-lang.org/ja/latest/class/OpenSSL=3a=3aCipher.html | |
module AesCipher extend self | |
KEY = "Your key" | |
CIPHER = "DES-ECB" | |
def encrypt(text) |
This file contains 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
# config/initializers/filter_parameter_logging.rb | |
Rails.application.config.filter_parameters += [:password] |
This file contains 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
# 書き方 | |
分 時 日 月 曜日 コマンド | |
# 曜日 | |
# 0, 7 => 日曜日 | |
# 1 ~ 6 => 月曜日 ~ 金曜日 | |
# cron一覧を確認 crontab -l | |
# cronの削除 crontab -r ※警告なしに全て消えるので注意 |
This file contains 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
"------------------------------------------------ | |
" プラグインのインストール | |
"------------------------------------------------ | |
filetype plugin indent off | |
if has('vim_starting') | |
set runtimepath+=~/.vim/bundle/neobundle.vim | |
call neobundle#begin(expand('~/.vim/bundle/')) | |
NeoBundleFetch 'Shougo/neobundle.vim' |
This file contains 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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
# gem "rails" | |
gem "oauth" | |
gem "dotenv" | |
gem "pry" | |
# for active_support/core_ext | |
gem "rails" |
OlderNewer