Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Johnson kyle-ssg

View GitHub Profile
View MMKV Test
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,
View Bullet Train Feature Flags V2.1.2
[
{
"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 Apr 9, 2020
Bullet Train flags
View 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 Apr 3, 2020
Animation example
View App.js
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 Feb 2, 2020
Trying out deno with Bullet Train
View bullet-train-deno.js
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 Nov 16, 2019
Recording ReactMarker times in react native to track performance
View MainApplication.java
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;
View webpack.dev.config.js
// 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',
View gist:8a4bcdc998738e719b71167736f4c1db
// 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',
View Write data to Bluetooth Low Energy Devices
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()
View gist:ddcc0255d5dd66ce572394042282c87d
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),