Skip to content

Instantly share code, notes, and snippets.

@daominhsangvn
daominhsangvn / CustomClientFactory
Created July 30, 2020 04:27 — forked from ecdundar/CustomClientFactory
React Native HTTPS Certificate Error Problem - Trust All Certificates
package com.myapplication.extensions;
import android.util.Log;
import com.facebook.react.modules.network.OkHttpClientFactory;
import com.facebook.react.modules.network.OkHttpClientProvider;
import com.facebook.react.modules.network.ReactCookieJarContainer;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
@daominhsangvn
daominhsangvn / wildcard-ssl-certificate.md
Created January 4, 2019 02:54 — forked from talyguryn/wildcard-ssl-certificate.md
How to get a wildcard ssl certificate and set up Nginx.

How to get and install a wildcard SSL certificate

In this guide you can find how to resolve the following issues.

Feel free to ask any questions in the comments section below.

@daominhsangvn
daominhsangvn / package-exact.js
Created May 11, 2018 03:02 — forked from kentcdodds/package-exact.js
make your package.json dependencies be the exact version that's in your node_modules currently
/* jshint node:true */
/* eslint-env node */
/*
* This will look at the current version of all of your dependencies and update your package.json
* with the specific version that you currently have in node_modules. This will save you from the
* sadness that is: DEPENDENCY MANAGEMENT
*
* Place this file in a folder that's a a sibling to your package.json and node_modules
* Then simply run: node scripts/package-strict
@daominhsangvn
daominhsangvn / letsencrypt_2017.md
Last active January 4, 2019 04:32 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@daominhsangvn
daominhsangvn / interview-questions-and-awnsers.md
Created January 12, 2018 08:05
Interview questions and awnsers

Javascript

  1. How to create a copy of an array such that changes to the old array will not be reflected in the new array?
// affected by using splice, pop, unshift, push...
var newArray = oldArray.splice(0);
  1. Function prototype?
@daominhsangvn
daominhsangvn / npm-publish.md
Last active December 13, 2017 05:03
How to publish package to npmjs
  1. $ npm login or $ npm adduser from your Terminal to login to NpmJS
  2. Add file .npmignore then ignore files that will not neccessary for the publish version
  3. $ npm pack to test the output
  4. $ npm init --scope=nois config org for the package
  5. $ npm publish --access public
@daominhsangvn
daominhsangvn / redux-react-nagivation-integration.md
Last active October 31, 2017 08:43 — forked from hle50/rm.md
Integrate React into React with React-Navigation
  1. Install redux $ yarn add react-redux
  2. At project root folder, create folder store then create file configureStore.js in store folder:
import { createStore } from 'redux';
 
import reducers from '../reducers'
 
export default function configureStore(initialState) {
  const store = createStore(
    reducers,
@daominhsangvn
daominhsangvn / create-nois-react-native-project.md
Last active September 28, 2017 08:42
Create NOIS React-Native Project
  1. Init project:
$ react-native init <project_name>
  1. Add main dependencies:
$ yarn add moment lodash react-native-elements react-native-fetch-blob https://github.com/newoceaninfosys/react-native-gifted-form react-native-i18n react-native-image-crop-picker react-native-keyboard-aware-scroll-view react-native-loading-spinner-overlay react-native-navbar react-native-splash-screen react-native-vector-icons react-navigation realm