# 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/lockfile_generator' | |
module GitPatch | |
def initialize(options) | |
@skip_locking = options['skip_locking'] === true | |
super | |
end | |
def skip_locking? | |
@skip_locking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in **/*.@(rb) ;do | |
sed -i -e '$a\' $f | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in **/*.@(rb) ;do | |
sed -i -e '1i# frozen_string_literal: true\' $f | |
done |
NewerOlder