Skip to content

Instantly share code, notes, and snippets.


Muhammad Ghazali muhammadghazali

View GitHub Profile
GET /accounts

GET /accounts/_mapping

GET /accounts/_search
  "sort": [
      "account_number": "asc"
muhammadghazali /
Created Aug 22, 2018 — forked from soheilhy/
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,, and on the same machine using a single IP address.

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

muhammadghazali / install the go dep (the dependency management).md
Created Jul 16, 2018
install the go dep (the dependency management)
View install the go dep (the dependency management).md
curl | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5110  100  5110    0     0    762      0  0:00:06  0:00:06 --:--:--  1219
ARCH = amd64
OS = linux
Installation requires your GOBIN directory /home/xxx/go/bin to exist. Please create it.
View App-1.js
import React, { Component } from "react";
class App extends Component {
constructor() {
this.state = {
input1: ""
this.handleChange = this.handleChange.bind(this);
muhammadghazali /
Last active Jun 25, 2018
Setup prettier pre-commit Hook. This bash script is suitable if you have a project without prettier integration and interested to add prettier into your current development workflow.
#!/usr/bin/env bash
npm i -D --save-exact prettier
npm i -D pretty-quick husky --save
# to manipulate the existing package.json file
npm i -g json
# add precommit to package.json scripts
json -I -f package.json -e 'this.scripts.precommit="pretty-quick --staged"'
# add prettier config file
touch .prettierrc
echo '{
curl -sL | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs build-essential gcc g++ make
# fixing npm permissions
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
# use the NPM_CONFIG_PREFIX=~/.npm-global if you don't want to modify the .bashrc
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
View jsinspect-report.log
Match - 2 instances
import React, { Component } from 'react';
import { Link } from 'react-router';
import ExpandImage from '../containers/assets/icon_expand.svg';
import mapUS from '../containers/assets/map-us.svg';
import mapEurope from '../containers/assets/map-europe.svg';
import mapAsia from '../containers/assets/map-asia.svg';
muhammadghazali / Error: there can only be one only test.log
Created Oct 20, 2017
tape will complain if there is two exclusive test in the entire process
View Error: there can only be one only test.log
Error: there can only be one only test
at Function.test.only (/my-node-app/node_modules/tape/index.js:140:25)
at Function.module.exports.lazyLoad.only (/my-node-app/node_modules/tape/index.js:26:34)
at Object.<anonymous> (/my-node-app/test/api-endpoints/submit-registration-token.test.js:47:6)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
muhammadghazali / hello-world-module.js
Created Sep 13, 2017
This is a silly world hello module that can be used on the Node.js and browser environment. Credits to this blog post:
View hello-world-module.js
(exports => (exports.greet = () => "Hello world"))(
typeof exports === "undefined" ? (this["hello"] = {}) : exports
muhammadghazali / the-correct-approach-to-handle-stripe-timestamp.js
Created Mar 20, 2017
Converting the Stripe epoch timestamp to ISO 8601
View the-correct-approach-to-handle-stripe-timestamp.js
export function secondsToISOString(seconds) {
const date = new Date(seconds * 1000);
return date.toISOString();