Skip to content

Instantly share code, notes, and snippets.

View asaschachar's full-sized avatar

Asa Schachar asaschachar

View GitHub Profile
@asaschachar
asaschachar / project_javascript
Last active September 3, 2022 13:21
Project JavaScript
if (isComplex) {
for (var i=6, j='crazy'; i<isComplex.length; i+=3) {
while(j.length < 20) {
j = j.concat('hello');
switch (i % 2) {
case 0:
j = j.concat('U');
break;
case 1:
break;
@asaschachar
asaschachar / README.md
Last active May 3, 2022 11:55
Astronaut Workshop Demo Instructions

Astronaut Workshop Demo Instructions

Prequisites

  1. Create an Optimizely Account
  2. Navigate to the codepen and follow the instructions below!
  3. Turn off any ad-blockers! Ad-blockers can prevent this demo from working.

Instructions

  1. Initialize Optimizely with the following code (replacing SDK Key from your development environment):
@asaschachar
asaschachar / CompleteExample.html
Last active March 2, 2022 04:40
Optimizely Full Stack in a Static Site
<html>
<head>
<script src="https://unpkg.com/@optimizely/optimizely-sdk@3.5/dist/optimizely.browser.umd.min.js"></script>
<script src="https://cdn.optimizely.com/datafiles/V7kE2tbrJaYGmtRF5W5QXf.json/tag.js"></script>
</head>
<body>
<h1>Hello World</h1>
<p id="subtitle">This is a subtitle</p>
</body>
<script>

Exporting Optimizely Event Data

Note: This functionality requires an Optimizely plan with access to "Event Data Export"

The following uses the open source command line tool oevents.

Prerequisites

  • A terminal to run the oevents bash script (any OS X and most GNU/Linux distributions)
  • jq - a command-line processor
  • curl (Note: All versions of OS X starting with Jaguar come with curl installed)
  • The Amazon AWS CLI (v2+)

Backend Feature Flags in NodeJS

Prerequisites

  • Node version >= 8.1
  • npm version >= 5.6

Steps

# myapp.rb
require 'sinatra'
require './optly'
get '/' do
enabled = Optly.instance.client.is_feature_enabled('hello_world', 'user123', {
'customerId' => 123,
'isVIP' => true
})
enabled = Optly.instance.client.is_feature_enabled('hello_world', 'user123', {
'customerId' => 123,
'isVIP' => true
})
enabled ? 'Hello World! You got the hello_world feature!' : 'You did not get the hello_world feature'
# myapp.rb
require 'sinatra'
require './optly' # Imports the Optimizely singleton
get '/' do
'Hello world!'
end