Skip to content

Instantly share code, notes, and snippets.

EdwardDiehl /
Created September 6, 2023 16:12 — forked from ssrihari/
An opinionated list of excellent Clojure learning materials
EdwardDiehl /
Created September 6, 2023 16:12 — forked from ssrihari/
An opinionated list of excellent Clojure learning materials
View documents.rb
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
resource :lock
EdwardDiehl / Gemfile
Created July 4, 2023 05:46 — forked from dhh/Gemfile
HEY's Gemfile
View Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
EdwardDiehl / 1-activerecord.rb
Created June 13, 2023 20:00 — forked from janko/1-activerecord.rb
INSERTing 50,000 records into a database in ActiveRecord, Arel, SQL, activerecord-import and Sequel.
View 1-activerecord.rb
require "active_record"
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
ActiveRecord::Migration.class_eval do
create_table(:records) do |t|
t.string :column
data = { |i| Hash[column: "Column #{i}"] }
EdwardDiehl /
Created February 6, 2023 21:56 — forked from wojteklu/
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

EdwardDiehl / globals-debugger.js
Created February 19, 2022 20:03 — forked from mmazzarolo/globals-debugger.js
Track down the JavaScript code responsible for polluting the global scope
View globals-debugger.js
* GlobalsDebugger
* Inspect the stack when a global variable is being set on the window object.
* Given a global variable name, it proxies the variable name in the window
* object adding some custom code that will be invoked whenever the variable
* is set. The custom code will log the current stack trace and halt the code
* execution to allow inspecting the stack and context in your browser DevTools.
* You can use the "globalsToInspect" query-parameter to set a comma-separated
* list of names of the variables you want to inspect.
EdwardDiehl /
Created February 8, 2022 05:54 — forked from zmts/
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication
EdwardDiehl / github-to-bitbucket
Created July 27, 2019 08:23 — forked from sangeeths/github-to-bitbucket
Forking a Github repo to Bitbucket
View github-to-bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
EdwardDiehl / arrays_transformations_benchmark.rb
Created June 20, 2019 19:02
arrays transformations benchmark
View arrays_transformations_benchmark.rb
# source:
require "benchmark/inputs"
[1, 2, 3],
[1, nil, 2, nil, 3, nil],
[nil, nil, nil],