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
CustomResponseHeader: | |
Type: AWS::Serverless::Function | |
Properties: | |
# FunctionName: !Sub ${AWS::StackName}-CustomResponseHeader | |
Handler: index.handler | |
Runtime: nodejs12.x | |
AutoPublishAlias: live | |
AssumeRolePolicyDocument: | |
Version: 2012-10-17 | |
Statement: |
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 'benchmark/ips' | |
require 'active_support/hash_with_indifferent_access' | |
require 'active_support/core_ext/hash' | |
class Hash | |
def except_new(*keys) | |
slice(*(self.keys - keys)) | |
end | |
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
package main | |
import ( | |
"strconv" | |
"github.com/brutella/hc" | |
"github.com/brutella/hc/log" | |
"github.com/brutella/hc/accessory" | |
) | |
type Bridge struct { |
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
<html> | |
<head> | |
<style> | |
body { | |
counter-reset: n; | |
} | |
div:before { | |
counter-increment: n; | |
content: counter(n); | |
} |
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 Create < Trailblazer::Operation | |
include Model | |
model Workflow | |
contract do | |
property :name | |
property :description | |
collection :steps, populate_if_empty: Step do | |
property :form, populate_if_empty: lambda { |params, *| Form.find(params[:workflow][:steps][:form][:id]) } |
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 SkipableCallbacks | |
def initialize(params, options = {}) | |
@skip_callbacks = params.delete(:skip_callbacks) || {} | |
super | |
end | |
def dispatch!(name = :default) | |
org_callbacks = self.class.callbacks[name] | |
self.class.callbacks[name] = org_callbacks.clone | |
@skip_callbacks[name] && @skip_callbacks[name].each do |callback| |
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
def find_route_name(path) | |
Rails.application.routes.routes.select do |route| | |
route.path.match path | |
end.map(&:name).compact.first | |
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 ApplicationController < ActionController::Base | |
include Trailblazer::Operation::Controller | |
include Trailblazer::WithCurrentUser | |
self.trb_with_current_user_param_key = :current_user | |
self.trb_with_current_user_method = :current_user | |
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
ActiveSupport::Subscriber.subscribers.flat_map(&:patterns).grep(/trailblazer/).map &ActiveSupport::Notifications.method(:unsubscribe) |
NewerOlder