Skip to content

Instantly share code, notes, and snippets.

View rainstormza's full-sized avatar

Supakorn Thongtra rainstormza

View GitHub Profile
@rainstormza
rainstormza / App.js
Created April 3, 2018 10:55
Code Splitting React js
// Dynamically imported components
const RegisterPage = asyncComponent(() =>
import('./register/RegisterPage').then(module => module.default)
)
const SearchPage = asyncComponent(() =>
import('./search/SearchPage').then(module => module.default)
)
const ReportPage = asyncComponent(() =>
import('./report/ReportPage').then(module => module.default)
)
import { Component, OnInit } from '@angular/core';
declare const iOS: any;
declare const Android: any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
Allowed <type> values:
feat (new feature)
fix (bug fix)
docs (changes to documentation)
style (formatting, missing semi colons, etc; no code change)
refactor (refactoring production code)
test (adding missing tests, refactoring tests; no production code change)
chore (updating grunt tasks etc; no production code change)
@rainstormza
rainstormza / uniq.js
Created September 22, 2017 08:29 — forked from telekosmos/uniq.js
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@rainstormza
rainstormza / read-files.js
Created August 10, 2017 08:30 — forked from betweenbrain/read-files.js
Node.js read multiple files, write into one
var fs = require('fs');
var Promise = require('promise');
var promises = [];
var readline = require('readline');
var readFile = function (file) {
return new Promise(function (resolve, reject) {
var lines = [];
var rl = readline.createInterface({
input: fs.createReadStream('./logs/' + file)
@rainstormza
rainstormza / ngrxintro.md
Created June 3, 2017 06:48 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@rainstormza
rainstormza / React Emmet
Last active May 30, 2017 02:44 — forked from mxstbr/Readme.md
Enable tab completion for JSX with Emmet in Atom
# Enable tab completion for JSX with Emmet in Atom
*This guide assumes you have the `emmet` and `language-babel` packages already installed in Atom*
![Gif of the tab completion working](http://i.imgur.com/09oOsHx.gif)
1. Open the `keymap.cson` file by clicking on `Atom -> Keymap…` in the menu bar
2. Add these lines of code to your keymap:
```CSON
'atom-text-editor[data-grammar~="jsx"]:not([mini])':

Step 1

Get a VPS that offers 2 or more IP addresses.

Step 2

From the WHM cPanel, find the menu item Service Configuration, select Apache Configuration and then click on Reserved IPs Editor.

Step 3