Skip to content

Instantly share code, notes, and snippets.

@biborn
biborn / java_download.sh
Created October 8, 2019 02:26 — forked from wavezhang/java_download.sh
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.tar.gz
@biborn
biborn / handling_multiple_github_accounts.md
Created August 10, 2019 20:38 — forked from Jonalogy/handling_multiple_github_accounts.md
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@biborn
biborn / sql-mongo_comparison.md
Created July 16, 2019 10:54 — forked from aponxi/sql-mongo_comparison.md
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

@biborn
biborn / SharedLog.js
Created June 24, 2019 20:53 — forked from ericwastaken/SharedLog.js
log4js singleton pattern
/**
* Creates and returns a reference to a shared instance of log4js. Only a single instance is created
* regardless of how many references are made.
*
* To set your desired log level, change the following line to suit your needs.
* - `const config = { logLevel: 'debug' };`
*
* In another module or file that you wish to log, do the following:
* - `const SharedLog = require('./path/to/SharedLog.js');`
* - `const logger = SharedLog.getInstance().logger;`
@biborn
biborn / nginxproxy.md
Created November 29, 2018 19:28 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@biborn
biborn / Dockerfile
Created October 18, 2018 19:09 — forked from Mikulas/Dockerfile
Docker image PHP 7.1 alpine with extensions
FROM php:7.1-fpm-alpine
RUN apk add --update \
autoconf \
g++ \
libtool \
make \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install mysqli \
@biborn
biborn / wordpress-example
Created September 9, 2018 18:47 — forked from julienbourdeau/wordpress-example
Nginx Server Configuration - WordPress
server {
server_name _DOMAIN_;
root /home/_USER_/www/_DOMAIN_;
index index.php;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
charset utf-8;
@biborn
biborn / InstallZshOnCentOS.md
Created September 9, 2018 17:09 — forked from rkaneko/InstallZshOnCentOS.md
Installing zsh on CentOS

Installing zsh on CentOS

$ sudo yum install ncurses-devel

$ cd /usr/local/src

$ sudo curl -L http://sourceforge.net/projects/zsh/files/zsh/5.0.7/zsh-5.0.7.tar.gz/download -o zsh-5.0.7.tar.gz

Lifecycle in React Native Component

When we are developing our app, there are some features we always need to add, e.g. ListView components only refresh when the data in listItem is changed, initializing data before render function but not in the constructor function…

React Native component has already been implemented with many native optimization for us, but those features above are not. To do that, we need to override lifecycle function in React Native component.

The Component Lifecycle API

First of all, this is the official site docs about the API we could use:https://facebook.github.io/react/docs/react-component.html#the-component-lifecycle

The order of lifecycle should be: constructor() -> componentWillMount() -> render() -> componentDidMount() -> [ runtime loop ] -> componentWillUnmount()

@biborn
biborn / ListView to FlatList.diff
Created August 25, 2018 15:00 — forked from cooperka/ListView to FlatList.diff
Migrating from ListView to FlatList in React Native.
-import { Text, View, ListView } from 'react-native';
+import { Text, View, FlatList } from 'react-native';
import style from './styles';
import listData from './listData';
class App extends Component {
- constructor(props) {
- super(props);