Skip to content

Instantly share code, notes, and snippets.

View muhammadghazali's full-sized avatar

Muhammad Ghazali muhammadghazali

View GitHub Profile
@muhammadghazali
muhammadghazali / What is server_names_hash_bucket_size.md
Last active February 9, 2024 14:13
Nginx: What is server_names_hash_bucket_size?

Background

While I'm learning how to use Nginx, I was instructed to update the server_names_hash_bucket_size (/etc/nginx/nginx.conf) value from 32 to 64, but I don't understand why should I increase the value to 64.

References

References that have been read so far:

@muhammadghazali
muhammadghazali / 01-angularjs-introduction.md
Last active October 14, 2022 06:19
Notes on AngularJS

What is AngularJS

  • AngularJS is not a library, it's a framework that embraces extending HTML into a more expressive and readable format
  • AngularJS is a structural framework for dynamic web apps
  • A framework that lets you use HTML as your template language and extend HTML's syntax to express your application's components clearly and succinctly
  • Angular is an opinionated framework on how a CRUD application should be built

Use AngularJS to build CRUD application

  • Angular was built for the CRUD application in mind. Games and GUI editors are examples of applications with intensive and tricky DOM manipulation. These kinds of apps are different from CRUD apps, and as a result are probably not a good fit for Angular
@muhammadghazali
muhammadghazali / the-correct-approach-to-handle-stripe-timestamp.js
Created March 20, 2017 05:35
Converting the Stripe epoch timestamp to ISO 8601
export function secondsToISOString(seconds) {
const date = new Date(seconds * 1000);
return date.toISOString();
}
@muhammadghazali
muhammadghazali / delete-file-from-git-history.md
Last active February 26, 2020 14:24
Deleting file from Git history

Example 1

Deleting .env:

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch .env' --prune-empty --tag-name-filter cat -- --all

Example 2

GET /accounts

GET /accounts/_mapping

GET /accounts/_search
{
  "sort": [
    {
      "account_number": "asc"
@muhammadghazali
muhammadghazali / nginxproxy.md
Created August 22, 2018 11:14 — 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

@muhammadghazali
muhammadghazali / install the go dep (the dependency management).md
Created July 16, 2018 04:12
install the go dep (the dependency management)
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | 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.
import React, { Component } from "react";
class App extends Component {
constructor() {
super();
this.state = {
input1: ""
};
this.handleChange = this.handleChange.bind(this);
@muhammadghazali
muhammadghazali / setup-prettier-precommit-hook.sh
Last active June 25, 2018 15:37
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 '{