Skip to content

Instantly share code, notes, and snippets.

View Aung-Myint-Thein's full-sized avatar

Aung Myint Thein Aung-Myint-Thein

View GitHub Profile
@Aung-Myint-Thein
Aung-Myint-Thein / function.js
Last active January 31, 2021 10:32
Sample function call to redis
const { getCachedDataByKey, setDataToCache } = require('../../redis');
const checkUser = async (user_id, item) => {
let user_access = await getCachedDataByKey("item_access_" + item + "_" + user_id);
if (!user_access) {
// get the data from database for user_id for item and assign to user_access
setDataToCache("item_access_" + item + "_" + user_id, user_access);
}
@Aung-Myint-Thein
Aung-Myint-Thein / redis_provider.js
Last active January 31, 2021 10:22
Redis connection provider
const Redis = require("ioredis");
const client = new Redis({
host: "redis_host",
port: "redis_port",
connectTimeout: 2000,
lazyConnect: true,
maxRetriesPerRequest: 2,
reconnectOnError: function(err) {
if (err.message.startsWith('READONLY')) {
@Aung-Myint-Thein
Aung-Myint-Thein / react_native_commands.md
Last active June 28, 2022 02:34
General commands for React Native developers

For General

Clear watchman watches: watchman watch-del-all.

Delete the node_modules folder: rm -rf node_modules && npm install.

Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.

Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.

@Aung-Myint-Thein
Aung-Myint-Thein / CircularProgress.js
Created April 1, 2020 05:32
React Native Circular Progress Component using react-native-svg
import React from "react";
import { View } from "react-native";
import { Svg, Circle, Text as SVGText } from 'react-native-svg'
const CircularProgress = (props) => {
const { size, strokeWidth, text } = props;
const radius = (size - strokeWidth) / 2;
const circum = radius * 2 * Math.PI;
const svgProgress = 100 - props.progressPercent;