The main generator
# lib/generators/rails/policy/policy_generator.rb
module Rails
module Generators
class PolicyGenerator < NamedBase
source_root File.expand_path('templates', __dir__)
def copy_policy_file
# lib/generators/rails/policy/policy_generator.rb
module Rails
module Generators
class PolicyGenerator < NamedBase
source_root File.expand_path('templates', __dir__)
def copy_policy_file
# Put this file into app/models/concerns | |
module IssuePatch | |
extend ActiveSupport::Concern | |
included do | |
before_validation :do_some_work | |
end | |
def do_some_work | |
# Your code here |
require 'bundler/lockfile_generator' | |
module GitPatch | |
def initialize(options) | |
@skip_locking = options['skip_locking'] === true | |
super | |
end | |
def skip_locking? | |
@skip_locking |
module Arel::Predications | |
def any(right) | |
Arel::Nodes::Any.new(self, quoted_node(right)) | |
end | |
end | |
class Arel::Nodes::Any < Arel::Nodes::Binary | |
def operator | |
:'ANY' | |
end |
module CustomEnumerable | |
def map(sym = nil) | |
return enum_for(:map) if !block_given? && sym.nil? | |
raise SyntaxError if block_given? && !sym.nil? | |
result = [] | |
each do |item| | |
result << (sym.nil? ? yield(item) : item.send(sym)) | |
end | |
result | |
end |
class Array | |
def each(sym = nil) | |
return enum_for(:each) if !block_given? && sym.nil? | |
raise SyntaxError if block_given? && !sym.nil? | |
i = 0 | |
while i < self.length | |
sym.nil? ? yield(self[i]) : self[i].send(sym) | |
i += 1 | |
end | |
self |
DROP PROCEDURE IF EXISTS tree_recover; | |
DELIMITER // | |
CREATE PROCEDURE tree_recover() | |
MODIFIES SQL DATA | |
BEGIN | |
DECLARE currentId, currentParentId CHAR(36); | |
DECLARE currentLeft INT; | |
DECLARE startId INT DEFAULT 1; |
#!/bin/sh | |
spd-say "You motherfucker, come on you little ass… fuck with me, eh? You fucking little asshole, dickhead cocksucker…You fuckin' come on, come fuck with me! I'll get your ass, you jerk! Oh, you fuckhead motherfucker! Fuck all you and your family! Come on, you cocksucker, slime bucket, shitface turdball! Come on, you scum sucker, you fucking with me? Come on, you asshole" |
for f in **/*.@(rb) ;do | |
sed -i -e '$a\' $f | |
done |
for f in **/*.@(rb) ;do | |
sed -i -e '1i# frozen_string_literal: true\' $f | |
done |