import React, { Component } from 'react';
import { Text, View, FlatList, Dimensions, Button, StyleSheet } from 'react-native';
const { width } = Dimensions.get('window');
const style = {
justifyContent: 'center',
alignItems: 'center',
width: width,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs' | |
import { Transform } from 'stream' | |
import JSONStream from 'JSONStream' | |
// Custom transform stream | |
const transformer = new Transform({ | |
objectMode: true, | |
transform(jsonItem, encoding, callback) { | |
// your logic goes here... | |
// const updatedItem = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type JsonObject = { | |
[key: string]: any; | |
}; | |
const jsonObject: any = { | |
access_token: 'xseHuyOiup08EubvER', | |
Password: 12345, | |
refresh_token: 'ytuio.OplaxwRtU', | |
Authorization: 'az643hrbfj_rueik==' | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* | |
Load test an api endpoint using sample json input data from a file. Sample json file should be one json string per line. | |
./load.js -c 2 -t 5 --rps 5 https://APIGATEWAYENDPOINT.execute-api.us-east-1.amazonaws.com/Prod/ | |
-c concurrency | |
-t load test duration in seconds | |
--rps requests per second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist | |
rm -fr ~/Library/Preferences/com.microsoft.VSCode.plist | |
rm -fr ~/Library/Caches/com.microsoft.VSCode | |
rm -fr ~/Library/Caches/com.microsoft.VSCode.ShipIt/ | |
rm -fr ~/Library/Application\ Support/Code/ | |
rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/ | |
# rmeove all extensions |
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# This script will start three shards, a config server and a mongos, all on the current machine. | |
# | |
# It was written for Mongo 3.4, based on https://docs.mongodb.com/manual/tutorial/deploy-shard-cluster/ | |
# | |
# This script is only for testing purposes. In production, you would run each of these servers on a different machine. | |
# | |
# The first time you run it, pass this variable for the initial setup: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongoserver:PRIMARY> rs.status(); | |
{ | |
"set" : "mongoserver", | |
"date" : ISODate("2016-02-02T10:47:07.510Z"), | |
"myState" : 1, | |
"members" : [ | |
{ | |
"_id" : 3, | |
"name" : "192.168.1.10:37017", | |
"health" : 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// is-iphone-x.js | |
import { Dimensions, Platform } from 'react-native'; | |
export function isIphoneX() { | |
const dim = Dimensions.get('window'); | |
return ( | |
// This has to be iOS | |
Platform.OS === 'ios' && |
NewerOlder