Skip to content

Instantly share code, notes, and snippets.

View r7kamura's full-sized avatar

Ryo Nakamura r7kamura

View GitHub Profile
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "activerecord", "6.0.0.beta1", require: "active_record"
gem "sqlite3"
end
ActiveRecord::Base.logger = Logger.new(STDOUT)
@r7kamura
r7kamura / README.md
Last active March 19, 2021 09:40
Migration from Sprockets to Webpack

Directory structure

Before

.
|-- app/
|   `-- assets/
|       |-- fonts/
|       |-- images/
FROM ruby:2.5.1
WORKDIR /app
RUN gem install bundler -v 2.0.1
COPY \
Gemfile \
Gemfile.lock \
/app/
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rails', '5.1.6'
end
require 'action_controller/railtie'
require 'minitest/autorun'
$ tsc --init
message TS6071: Successfully created a tsconfig.json file.
$ cat -e tsconfig.json | tail
    // "sourceRoot": "",                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */$
    // "mapRoot": "",                         /* Specify the location where debugger should locate map files instead of generated locations. */$
    // "inlineSourceMap": true,               /* Emit a single file with source maps instead of having a separate file. */$
    // "inlineSources": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */$
$
 /* Experimental Options */$
@r7kamura
r7kamura / active_record_scoping.rb
Last active November 29, 2018 10:09
Inspection of the behaviors change between ActiveRecord 5.1.6 and 5.2.0.
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'activerecord', '5.2.0', require: 'active_record'
gem 'sqlite3'
end
ActiveRecord::Base.establish_connection(
text = <<EOS
.a
.a
-a
+a
+a
.a
-a
-a
+a
This file has been truncated, but you can view the full file.
commit 78842a4c6617fa5b244758362f5e154600faf3ef
Author: r7kamura <r7kamura@gmail.com>
Date: Sat Nov 10 23:27:26 2018 +0900
WIP
diff --git a/faq/block.rd b/faq/block.rd
index 0fd28605..6f2e1526 100644
--- a/faq/block.rd
+++ b/faq/block.rd
# frozen_string_literal: true
RSpec.describe RuboCop::Cop::Style::RegexpLiteral, :config do
subject(:cop) { described_class.new(config) }
let(:config) do
supported_styles = {
'SupportedStyles' => %w[slashes percent_r mixed]
}
RuboCop::Config.new('Style/PercentLiteralDelimiters' =>
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "activerecord", "5.2.1", require: "active_record"
gem "sqlite3"
end
ActiveRecord::Base.establish_connection(