Skip to content

Instantly share code, notes, and snippets.

View ethan605's full-sized avatar

Thanh Nguyen ethan605

View GitHub Profile
@ethan605
ethan605 / RoutersMiddleware.js
Last active June 8, 2017 01:02
A middleware for `react-navigation` library to prevent duplicated navigates. Note that is is a hack/workaround that works but not an official solution for React Navigation.
/**
* A middleware to detect short-time action dispatches
* This will check all 'Navigation/' prefixed actions
* which are duplicated over a short duration (`DISPATCH_THROTTLE`)
* and prevent them to be reduced to make new states.
*/
import Singleton from 'singleton';
import _ from 'lodash';
@ethan605
ethan605 / GenyMotion with Google Play.md
Last active October 9, 2017 01:23 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services for ARM

Note: Easier way is the X86 way, described here

  1. Download the following ZIPs:

Note: Genymotion must be set to use it's own ADB (Settings -> ADB -> Use Genymotion Android tools)

  1. Open your Genymotion VM and go to the Homescreen
import React from 'react';
import { StyleSheet, View } from 'react-native';
import Button from 'react-native-button';
import _ from 'lodash';
export default class ZIndexExp extends React.PureComponent {
state = { topBoxIndex: 2 };
changeTopBox = () => {
const { topBoxIndex } = this.state;
/**
* @providesModule WeFit.Redux.Store.createStorePersistor
*/
import { AsyncStorage, Platform } from 'react-native';
import { Logger } from '@onaclover/react-native-utils';
import { createPersistor, createTransform, getStoredState } from 'redux-persist';
import FilesystemStorage from 'redux-persist-filesystem-storage';
import _ from 'lodash';

Architectures & Patterns

  • MVVM (Model - View - View Model): to avoid Massive View Controllers, but simpler than VIPER
  • ReactiveCocoa: functional reactive programming in Swift, supports hot/cold signals, active community
  • RxSwift: functional reactive programming in Swift, backed by ReactiveX, syntax-friendly & compatible with other ReactiveX extensions (RxJS etc...)  

Layouts

  • Storyboard: for specific UI customizations (colors, images,...)
  • SnapKit: for flexible layout rendering without touching complicated AutoLayout setups
@ethan605
ethan605 / KBD75.md
Last active April 18, 2020 04:43
Mechanical keyboards

1. Flash instructions

  1. Install Homebrew.
  2. Download and install QMK Toolbox. NOTE: If the application can't be opened normally, may be it's lacking libusb library:
  $ brew install libusb
  1. Run commands:
@ethan605
ethan605 / gulp.babel.js
Last active December 5, 2018 07:45
Gulp task to convert locale json file <=> csv
/**
* I18n translations helpers
*/
// Built-in modules
import fs from 'fs';
// Gulp modules
import gulp from 'gulp';
import clean from 'gulp-clean';

Keybase proof

I hereby claim:

  • I am ethan605 on github.
  • I am ethan605 (https://keybase.io/ethan605) on keybase.
  • I have a public key whose fingerprint is 4B32 8F02 F02A 0D5C 2312 7E7E C086 CD9B 4DBC BBC0

To claim this, I am signing this object:

@ethan605
ethan605 / .eslintrc.js
Last active September 5, 2019 07:46
A simple method to flatten an array of arbitrarily nested arrays of integers into a flat array of integers
module.exports = {
env: {
es6: true,
node: true,
jest: true,
},
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'prettier/standard'
@ethan605
ethan605 / !nerdfont-icons
Last active March 30, 2023 12:33
List all icons supported by a nerd font
We couldn’t find that file to show.