Skip to content

Instantly share code, notes, and snippets.

View TrumpClone's full-sized avatar

Optimus Advocate TrumpClone

View GitHub Profile
# rubocop:disable all
class Module
# TODO: (@exclusive) refactor and make PR to Ruby on Rails (ActiveSupport)
# NOTE: rails => /v4.2.10/activesupport/lib/active_support/core_ext/module/delegation.rb
module FixNumberNamedMethodsDelegation
# NOTE: rails => /v4.2.10/activesupport/lib/active_support/core_ext/module/delegation.rb
def delegate(*methods)
options = methods.pop
unless options.is_a?(Hash) && to = options[:to]
# frozen_string_literal: true
# @see https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/store.rb
module ActiveRecord::Store::ClassMethods
def multi_store_accessor(store_attributes, *keys, store_host: nil)
store_host = store_attributes.first unless store_host
keys = keys.flatten
_store_accessors_module.module_eval do
keys.each do |key|
@TrumpClone
TrumpClone / GG NO RE LOH
Created January 24, 2018 11:57
SUBLIME KEK PEK
[
{ "keys": ["super+§"], "command": "copy_path" },
{ "keys": ["super+option+§"], "command": "reveal_in_side_bar" }
]
@TrumpClone
TrumpClone / asdasdasd
Created December 26, 2017 12:19
asdasd
# frozen_string_literal: true
module Distribution::Transmission::Hooks::Hookable
HookError = Class.new(StandardError)
UnexistentHookError = Class.new(HookError)
class << self
def included(base_class)
base_class.extend ClassMethods
end
# frozen_string_literal: true
module Distribution::Transmission::Hooks::Hookable
HookError = Class.new(StandardError)
UnexistentHookError = Class.new(HookError)
class << self
def included(base_class)
base_class.extend ClassMethods
end
# frozen_string_literal: true
module Distribution::Transmission::Hooks::Hookable
HookError = Class.new(StandardError)
UnexistentHookError = Class.new(HookError)
class << self
def included(base_class)
base_class.extend ClassMethods
end
# frozen_string_literal: true
module Distribution::Transmission::Hooks::Hookable
HookError = Class.new(StandardError)
UnexistentHookError = Class.new(HookError)
class << self
def included(base_class)
base_class.extend ClassMethods
end
# frozen_string_literal: true
module Distribution::Transmission::Hooks::Hookable
HookError = Class.new(StandardError)
UnexistentHookError = Class.new(HookError)
class << self
def included(base_class)
base_class.extend ClassMethods
end
@TrumpClone
TrumpClone / Gemfile
Created November 17, 2017 10:31 — forked from pboling/Gemfile
My latest project's Gemfile, implements bundle group pattern
source 'https://rubygems.org'
# Follows the bundler group pattern described here:
# http://iain.nl/getting-the-most-out-of-bundler-groups
# Gemfile.mine in root dir allows locally custom gems.
# NOTE: Doing this will change the Gemfile.lock - commit with care.
eval File.read(File.join(File.dirname(__FILE__), 'Gemfile.mine')) if File.exists? File.join(File.dirname(__FILE__), 'Gemfile.mine')
ruby '1.9.3'
@TrumpClone
TrumpClone / README.md
Created July 13, 2017 14:11 — forked from chrisroos/README.md
Example of using bundler/inline

I came across 'bundler/inline' in Bundler pull request 3440, which I'd found from Rails pull request 20429. This now has a little snippet on the What's new page of the Bundler site.

This little example demonstrates how I might use it to create a single file using minitest.

I've just noticed that this script was working for me because I already had minitest installed as a system gem. If I uninstall the gem then the script fails because it can't find minitest. The source code documents an option to install gems if they don't exist (gemfile(true) do) but that doesn't seem to work for me. I see the following error:

Fetching gem metadata from https://rubygems.org/...
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...

Using metaclass 0.0.4