| defmodule TravelerWeb.SearchbarLive do | |
| use TravelerWeb, :live_view | |
| alias Phoenix.LiveView.JS | |
| alias Traveler.Places | |
| def mount(_params, _session, socket) do | |
| socket = assign(socket, places: []) | |
| {:ok, socket, layout: false} | |
| end |
These snippets provide a foundation for starting and stopping supervision trees at runtime using feature flags (e.g. Launch Darkly).
Some things to note when adapting these snippets:
ld_key) specified.FeatureFlags module to be available that implements is_on?/2. Adjust as needed to accomodate your own feature flag setup.| // Import the Hubspot NodeJS Client Library - this will allow us to use the HubSpot APIs | |
| const hubspot = require('@hubspot/api-client'); | |
| /* | |
| This function is called when the custom code action is executed. It takes 2 arguements. The first is the event object which contains information on the currently enrolled object. | |
| The second is the callback function which is used to pass data back to the workflow. | |
| */ | |
| exports.main = (event, callback) => { | |
| // Instantiate a new HubSpot API client using the HAPI key (secret) |
| /* eslint-env node */ | |
| const { Webpack } = require("@embroider/webpack"); | |
| const variant = { | |
| name: "dev", | |
| runtime: "browser", | |
| optimizeForProduction: false, | |
| }; | |
| const webpack = new Webpack( | |
| __dirname, | |
| __dirname + "/dist", |
| import { | |
| timeout, | |
| task | |
| } from 'ember-concurrency'; | |
| export class StateManager { | |
| constructor() { | |
| this.startExecution(); | |
| } |
| // UPDATE: don't use this. when it re-partitions the list when time moves forward, it does not correctly keep hashes | |
| // Use a real merkle tree instead: https://gist.github.com/jlongster/f431b6d75ef29c1a2ed000715aef9c8c | |
| import Timestamp from './timestamp'; | |
| // This is a compact data structure that keeps track of a list of | |
| // hashes (representing messages) over a range of time in order to | |
| // figure out what has changed between clients, kinda like a Merkle | |
| // tree. It creates "buckets" that represent different time ranges, | |
| // and divides time into smaller buckets the more recent they are. The |
For Chrome Canary:
alias hydra='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --no-sandbox --js-flags="--user-data-dir=/tmp/profile --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces"'For regular ol' Chrome:
Problem: Convert nested structs or nested encoded maps into a decoded map and remove keys with nil values.
Solution: Walk the structure and convert all structures to decoded map.
Before (nested struct):
%TopLevelStuct{
_type: "Purchase",
account_key: "ZBmrcY7sv47nCaZOx5TXBTJuazy"