Skip to content

Instantly share code, notes, and snippets.

View sgoedecke's full-sized avatar

Sean Goedecke sgoedecke

View GitHub Profile
class StoredMethod
attr_accessor :result, :method, :args
def initialize(result, method, args)
@result = result
@method = method
@args = args
end
def execute(obj)
res = obj.send(@method, @args)
@sgoedecke
sgoedecke / dotfiles
Last active September 3, 2021 02:36
--- stack
zsh, nvim, tmux
--- .vimrc
source ~/.vim/autoload/pathogen.vim
execute pathogen#infect()
call pathogen#helptags()
filetype indent plugin on
@sgoedecke
sgoedecke / rtes
Last active October 3, 2021 23:28
testd
# frozen_string_literal: true
module ActiveRecord
module Validations
class AbsenceValidator < ActiveModel::Validations::AbsenceValidator # :nodoc:
def validate_each(record, attribute, association_or_value)
if record.class._reflect_on_association(attribute)
association_or_value = Array.wrap(association_or_value).reject(&:marked_for_destruction?)
end
super
# frozen_string_literal: true
class PeopleHaveMiddleNames < ActiveRecord::Migration::Current
def self.up
add_column "people", "middle_name", :string
end
def self.down
remove_column "people", "middle_name"
end
# frozen_string_literal: true
module ActiveModel
module Validations
# == \Active \Model Absence Validator
class AbsenceValidator < EachValidator # :nodoc:
def validate_each(record, attr_name, value)
record.errors.add(attr_name, :present, **options) if value.present?
end
end
# frozen_string_literal: true
ORIG_ARGV = ARGV.dup
require "bundler/setup"
require "active_support/core_ext/kernel/reporting"
silence_warnings do
Encoding.default_internal = Encoding::UTF_8
Encoding.default_external = Encoding::UTF_8
# frozen_string_literal: true
module AbcHelper
def bare_a() end
end
# frozen_string_literal: true
class PeopleHaveMiddleNames < ActiveRecord::Migration::Current
def self.up
add_column "people", "middle_name", :string
end
def self.down
remove_column "people", "middle_name"
end
* Freescale 83xx and 512x PCI bridges
Freescale 83xx and 512x SOCs include the same PCI bridge core.
83xx/512x specific notes:
- reg: should contain two address length tuples
The first is for the internal PCI bridge registers
The second is for the PCI config space access registers
Example (MPC8313ERDB)