Queries to show GoodJob queue latency, runtime, and counts in Blazer
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
// Plain ol' JavaScript module for fetching feature flags from the server | |
// | |
// import { isEnabled } from './flipper.js' | |
// | |
// if (await isEnabled("new_feature")) { | |
// // render new feature | |
// } else { | |
// // render old feature | |
// } | |
// |
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
# config/initializers/flipper.rb | |
require 'flipper/adapters/sync' | |
Rails.application.configure do | |
# Disable per-request memoization | |
config.flipper.memoize = false | |
end | |
Flipper.configure do |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
require "flipper/adapters/dual_write" | |
require "flipper/adapters/poll" | |
Flipper.configure do |config| | |
config.adapter do | |
# Primary storage adapter | |
storage_adapter = Flipper::Adapters::ActiveRecord.new | |
# Poll the primary storage adapter every 10 seconds to get all features | |
poller = Flipper::Adapters::Poll::Poller.get('memoizer', { |
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
# Allow legacy jobs in the queue to be initialized and processed now that they use ActiveJob | |
# | |
# Each job must also define `#init_with(coder)` to define how serialized instance variables are | |
# used to initialize the new ActiveJob instance. | |
module Delayed::LegacyJob | |
class Proxy < SimpleDelegator | |
# ActiveJob calls `#perform_now` internally when executing a job to pass arguments to `#perform` | |
def perform | |
perform_now | |
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
# config/initializers/flipper.rb | |
ActiveSupport::Notifications.subscribe('feature_operation.flipper') do |event| | |
operation, feature_name, result = event.payload.values_at(:operation, :feature_name, :result) | |
return unless operation == :enabled? | |
result ? Bugsnag.add_feature_flag(feature_name) : Bugsnag.clear_feature_flag(feature_name) | |
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
# Register test groups | |
# https://www.flippercloud.io/docs/features#enablement-group | |
Flipper.register(:group_a) do |actor, context| | |
# Algorithm or database lookup to determine if a user is in this group | |
# e.g. 10% percentage of actors | |
crc32('group_a' + context.feature_name + actor.flipper_id) % 100 < 10 | |
end | |
Flipper.register(:group_b) do |actor, context| |
We're on the cusp of 2022 and most software is now written in JavaScript, but it is still virtually impossible to fail integration tests on a JavaScript error and get a useful stack trace from the browser.
This gist includes my description of the problem and sample code from my attempts to solve it.
- Integration test should fail (preferabbly immediately) on any uncaught JavaScript error (
window.onerror
,unhandledrejection
, etc) - The stack trace should use source maps and be close to what browsers show in DevTools
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 { Controller } from 'stimulus' | |
// Stimulus controller to save location of same-origin iframe in hash of parent | |
// window and restore on reload. | |
// | |
// <iframe src="…" | |
// data-controller="iframe-location" | |
// data-action="load->iframe-location#save"> | |
// </frame> | |
// |
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
age | length | price | |
---|---|---|---|
36 | 29 | 12500 | |
41 | 38 | 34900 | |
45 | 13 | 1250 | |
11 | 26 | 22400 | |
19 | 48 | 265000 | |
33 | 38 | 89900 | |
5 | 42 | 399000 | |
39 | 28 | 3200 | |
39 | 27 | 14750 |
NewerOlder