Skip to content

Instantly share code, notes, and snippets.

import { AsyncStorage } from "react-native";
import MMKVStorage from 'react-native-mmkv-storage';
var MMKVInstance;
const testObj = {
data: [
{
"_id": "5ef864ad075a9aa8d12f3d88",
"index": 0,
"guid": "b238c1fe-2dde-4a8a-be14-8343eb359d39",
"isActive": true,
[
{
"description": "Whether to show the try it buttons",
"name": "try_it",
"type": "FLAG"
},
{
"description": "Allows for new user overrides UX",
"name": "improved_identity_overrides",
@kyle-ssg
kyle-ssg / flags
Created April 9, 2020 12:14
Bullet Train flags
[
{
"description": "Whether to show the try it buttons",
"name": "try_it",
"type": "FLAG"
},
{
"name": "segments",
"description": "Determines whether users can see the 'Segments' option in the navigation panel",
},
@kyle-ssg
kyle-ssg / App.js
Created April 3, 2020 20:24
Animation example
import React, {PureComponent} from 'react';
import {Animated, View, StyleSheet, Text, Easing} from 'react-native';
export default class App extends PureComponent {
static displayName = 'TheComponent';
animatedValue = new Animated.Value(0);
render() {
// Coordinates of the parent View
const width = 50;
@kyle-ssg
kyle-ssg / bullet-train-deno.js
Last active February 2, 2020 20:45
Trying out deno with Bullet Train
let fetch;
let AsyncStorage;
const BULLET_TRAIN_KEY = "BULLET_TRAIN_DB";
const defaultAPI = 'https://api.bullet-train.io/api/v1/';
const BulletTrain = class {
constructor(props) {
if (props.fetch) {
fetch = props.fetch;
} else {
@kyle-ssg
kyle-ssg / MainApplication.java
Created November 16, 2019 10:49
Recording ReactMarker times in react native to track performance
package com.perf;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
// webpack.config.dev.js
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const whitelabel = typeof process.env.WHITELABEL === 'undefined' ? false : process.env.WHITELABEL;
const styles = whitelabel ? path.join(__dirname, `../web/styles/whitelabel/${process.env.WHITELABEL}`) : path.join(__dirname, '../web/styles');
module.exports = {
devtool: 'cheap-module-eval-source-map',
mode: 'development',
// webpack.config.dev.js
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const whitelabel = typeof process.env.WHITELABEL === 'undefined' ? false : process.env.WHITELABEL;
const styles = whitelabel ? path.join(__dirname, `../web/styles/whitelabel/${process.env.WHITELABEL}`) : path.join(__dirname, '../web/styles');
module.exports = {
devtool: 'cheap-module-eval-source-map',
mode: 'development',
import React, {Component, PropTypes} from 'react';
import {BleManager} from 'react-native-ble-plx';
const TheComponent = class extends Component {
displayName: 'TheComponent'
constructor(props, context) {
super(props, context);
this.state = {};
this.manager = new BleManager()
@kyle-ssg
kyle-ssg / gist:ddcc0255d5dd66ce572394042282c87d
Created February 16, 2018 10:30
Node Twitter List Follower
const admin = require("firebase-admin");
const Twit = require('twit')
const serviceAccount = require("./firebase-service-account.json");
const config = require('../config').twitter;
const T = new Twit(config)
const _ = require('lodash');
const SIMULATE = false;
console.log(JSON.stringify(config, null, 2))
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),