Skip to content

Instantly share code, notes, and snippets.

View mkjiau's full-sized avatar

Ming-Kai Jiau mkjiau

View GitHub Profile
@mkjiau
mkjiau / go-cheat-sheet.md
Created November 6, 2021 01:27 — forked from michaellihs/go-cheat-sheet.md
Go Cheat Sheet
public float totalChange = 0;
public float lastAzimuth = -1000;
public int r_count = 0;
private void FixedUpdate()
{
if (joycons.Count > 0)
{
Joycon j = joycons[jc_ind];
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { addNavigationHelpers } from 'react-navigation';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
// import DeviceInfo from 'react-native-device-info';
import Orientation from 'react-native-orientation';
import { ActionCreators } from '../redux/actions';
import AppNavigation from './AppNavigation';
import InitializingScreen from './InitializingScreen';
@mkjiau
mkjiau / axios-interceptors-refresh-token.js
Last active March 13, 2024 10:59
Axios interceptors for token refreshing and more than 2 async requests available
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
fetch(api.SEARCH_THE_ACCOUNT_ENDPOINT + "username=" + this.state.email, {
method: 'GET',
headers: {
'access_token': access_token
},
// body: formBody
}).then((response) => {
if (response.status >= 200 && response.status < 300) {
return response.json();
} else {
var apif1 = () => new Promise((resolve, reject) => {
setTimeout(resolve, 1000, "one");
});
var apif2 = () => new Promise((resolve, reject) => {
setTimeout(resolve, 2000, "two");
});
var apif3 = (values) => new Promise((resolve, reject) => {
var flattened = values.reduce((acc, val) => acc.concat(val));
setTimeout(resolve, 3000, flattened);
db.accounts.findById(id, function(error, user) {
//....AAAA
db.accounts.useUsertoDo(user, function(error, something) {
// use something to do something
});
});
//------------------------------
var promise1 = db.accounts.findById(id);
@mkjiau
mkjiau / happy_git_on_osx.md
Created July 6, 2017 14:49 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"