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 in the controller | |
def filters_for_this_action | |
_process_action_callbacks.select do |filter| | |
ifs = filter.options[:if].first || 'true' | |
unlesses = filter.options[:unless].first || 'false' | |
eval(ifs) && !eval(unlesses) | |
end.map { |filter| [filter.kind, filter.filter] } | |
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
/* This could be a way to reduce (haha) the redux boilerplate. */ | |
import {createStore} from "redux" | |
function createReduxModel(prefix, config) { | |
const actionType = (name) => `${prefix}_${name.toUpperCase()}_SET` | |
class Model { | |
constructor(store) { | |
for (const [name] of Object.entries(config)) { |
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
import {CSSTransition} from "react-transition-group" | |
import {forwardRef, useImperativeHandle, useRef, useState} from "react" | |
import {call} from "src/util/call" | |
export function useDebut(args: {enter?: () => any; exit: () => any}) { | |
const ref = useRef<any>() | |
const api = { | |
props: { | |
ref, | |
onExit: args.exit, |
OlderNewer