Skip to content

Instantly share code, notes, and snippets.

Jordan Garcia jordangarcia

Block or report user

Report or block jordangarcia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View optimizelyConfig.ts
interface KeyedEntity {
id: string
key: string
}
interface KeyedEntitySet<T extends KeyedEntity> {
getAll(): T[]
getKeys(): string[]
getById(id: string): T | null
getByKey(key: string): T | null
View optimizelyConfig.ts
export interface KeyedEntity {
id: string
key: string
}
export interface EntitySet<T> {
getById(id: string): T | null
getAll(): T[]
}
View paul.js
const module = createAPIModule('projects', {
baseUrl: 'http://api.optimizely.com/v2/',
serialize: a => a,
deserialize: a => a,
})
class ProjectActions extends BaseActions {
fetch = module.doGETRequest({
url: '/exp-api/projects/{id}',
queryParams: {
View rollouts-vue.md

3. Instantiate the client

We recommend creating an optimizely.js that exports an instantiated Optimizely client. This file can be required anywhere you want to use feature flagging.

// optimizely.js
import optimizelySDK from '@optimizely/optimizely-sdk'

const optimizely = optimizelySDK.createInstance({
  datafile: window.optimizelyDatafile['RWsw743bm1s8FwFaVXihzX'],
View board.ex
defmodule TicTacToe do
defmodule Board do
def create(maxX \\ 3, maxY \\ 3) do
for x <- 0..(maxX - 1),
y <- 0..(maxY - 1) do
{{x, y}, nil}
end
|> Map.new()
|> Map.put_new(:maxY, maxY)
|> Map.put_new(:maxX, maxX)
View test.js
const core = require('@optimizely/js-sdk-core')
// this will prefix all log messages with 'myModuleName: '
const logger = createLogger('myModuleName')
logger.log(core.LogLevel.INFO, 'same .log() API as before')
// or you can use debug / info / warn / error
logger.debug('this is a debug message')
logger.info('this is an info message')
logger.warn('this is a warning')
View test.js
const optimizelySDK = require('@optimizely/optimizely-sdk')
// setup with a noop logger
optimizelySDK.setLogger(optimizelySDK.createNoOpLogger())
const instance = optimizelySDK.createInstance(config)
View test.js
const optimizelySDK = require('@optimizely/optimizely-sdk')
// setup with a noop logger
optimizelySDK.setLoggerBackend(optimizelySDK.createNoOpLogger())
const instance = optimizelySDK.createInstance(config)
View test.js
const optimizelySDK = require('@optimizely/optimizely-sdk')
// setup with a noop logger
optimizelySDK.setLoggerBackend(optimizelySDK.createNoOpLogger())
const instance = optimizelySDK.createInstance(config)
View test.js
const optimizelySDK = require('@optimizely/optimizely-sdk')
// setup with a noop logger
optimizelySDK.setLoggerBackend(optimizelySDK.createNoOpLogger())
const instance = optimizelySDK.createInstance(config)
You can’t perform that action at this time.