Skip to content

Instantly share code, notes, and snippets.

const assert = require('assert');
const LaunchDarkly = require('launchdarkly-node-server-sdk');
// Check if the variable was passed on
assert(process.env.LD_SDK_KEY, 'env var "LD_SDK_KEY" should be passed to the command');
const featureFlagKey = 'is-app-enabled';
const config = {
key: `user-${Date.now()}`,
};
npm install launchdarkly-node-server-sdk --save
@willmendesneto
willmendesneto / list-unused-feature-flags-in-code.sh
Last active April 28, 2021 04:03
List unused Feature Flags in Code and checks for cleaned up feature flags in LaunchDarkly, so they can be removed from your codebase
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
# Mandatory arguments
LD_AUTH_TOKEN=""
PROJECT=""
# Optional arguments
Unused dependencies
* perf-marks
{
...
"devDependencies": {
"perf-marks": "^1.14.2"
}
...
}
npm install perf-marks --save-dev
mkdir my-project
cd my-project
npm init -y
// This file will live in `editor/icons.js`
export const MAXIMIZE_ICON =
'<svg class="maximize" width="24" height="24" viewBox="0 0 24 24" ><path d="M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"></path></svg>';
export const MINIMIZE_ICON =
'<svg class="minimize" width="24" height="24" viewBox="0 0 24 24" aria-hidden="true" tabindex="-1"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"></path></svg>';
export const BOLD_ICON =
'<svg class="bold" width="24" height="24" viewBox="0 0 24 24" aria-hidden="true" tabindex="-1"><path d="M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"></path></svg>';
export const ITALIC_ICON = '<svg class="italic" width="24" height="24" viewBox="0 0 24 24" aria-hidden="t
import React, { useState, useEffect } from "react";
import { Button, makeStyles } from "@material-ui/core";
import {
Editor,
MAXIMIZE_ICON,
MINIMIZE_ICON,
BOLD_ICON,
ITALIC_ICON,
Minimal as MinimalTheme,
Sea as SeaTheme