This file contains hidden or 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 MyController < ApplicationController | |
# ... | |
def search_all | |
return unless (@search_phrase = search_phrase_or_redirect) | |
doc_types = %w[Episode ForumPost Series] | |
notification_payload = { action: "search_all", search_phrase: @search_phrase, | |
doc_types: doc_types, pagy_limit: RESULT_PAGE_SIZE } | |
ActiveSupport::Notifications.instrument('search_render', notification_payload) do |
This file contains hidden or 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
# NOTE: this a partial copy of some working code from a working Rails app | |
# *However* it hasn't been tested on it's own, shown here as an example of | |
# using ActiveModel::Model as an alternative to ActiveRecord when you don't | |
# need the DB | |
class ContactRequest | |
include ActiveModel::Model | |
def self.define_sanitized_attr(attr) | |
define_method(attr) do |
This file contains hidden or 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
/* | |
Simple javascript to explore the React stateState function paradigm | |
node react_state_fn_upd_explore.js | |
Explore the second form of setState() that accepts a function rather than an | |
object. This is needed because React can batch state updates and | |
asynchronous state updates mean you need a function that receives its | |
current value before using values from it to set the next state | |
values. |
NewerOlder