Skip to content

Instantly share code, notes, and snippets.

View muhammadghazali's full-sized avatar

Muhammad Ghazali muhammadghazali

View GitHub Profile
curl -sL https://deb.nodesource.com/setup_8.x | 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
@muhammadghazali
muhammadghazali / web.config
Created November 17, 2012 10:19
IIS rewrite rules to remove index.php. I created this gist based on: http://stackoverflow.com/a/9965392/1061371
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<rewrite>
Match - 2 instances
./components/A.js:1,36
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
muhammadghazali / Error: there can only be one only test.log
Created October 20, 2017 00:39
tape will complain if there is two exclusive test in the entire process
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
muhammadghazali / hello-world-module.js
Created September 13, 2017 16:03
This is a silly world hello module that can be used on the Node.js and browser environment. Credits to this blog post: https://caolan.org/posts/writing_for_node_and_the_browser.html
(exports => (exports.greet = () => "Hello world"))(
typeof exports === "undefined" ? (this["hello"] = {}) : exports
);
let update = {
$set: {
hello: {
world: 'anything'
}
}
};
@muhammadghazali
muhammadghazali / regex-to-test-decimal-fraction-second-in-iso-8601.js
Created November 29, 2016 15:41
Regex to test whether the decimal fraction seconds is found or not in ISO 8601 datetime string
// the regex is generated using https://txt2re.com
// Time Stamp 1
var re1='((?:2|1)\\d{3}(?:-|\\/)(?:(?:0[1-9])|(?:1[0-2]))(?:-|\\/)(?:(?:0[1-9])|(?:[1-2][0-9])|(?:3[0-1]))(?:T|\\s)(?:(?:[0-1][0-9])|(?:2[0-3])):(?:[0-5][0-9]):(?:[0-5][0-9]))';
// Any Single Character 1
var re2='(\\.)';
// Any Single Digit 1
var re3='(\\d)';
// Any Single Digit 2
var re4='(\\d)';
// Any Single Digit 3
@muhammadghazali
muhammadghazali / do I need to reload the nginx when one of server blocks config changes?
Created November 18, 2016 07:05
do I need to reload the nginx when one of server blocks config changes?
TBD
@muhammadghazali
muhammadghazali / npm-debug.log
Last active October 21, 2016 08:58
npm ERR! code ENOENT during npm install caused by failed to locate specific directory
96048 silly gunzTarPerm extractEntry array/last.js
96049 silly gunzTarPerm modified mode [ 'array/last.js', 420, 436 ]
96050 silly gunzTarPerm extractEntry array/lastIndexOf.js
96051 silly gunzTarPerm modified mode [ 'array/lastIndexOf.js', 420, 436 ]
96052 silly gunzTarPerm extractEntry array/object.js
96053 silly gunzTarPerm modified mode [ 'array/object.js', 420, 436 ]
96054 silly gunzTarPerm extractEntry array/pull.js
96055 silly gunzTarPerm modified mode [ 'array/pull.js', 420, 436 ]
96056 silly gunzTarPerm extractEntry array/intersection.js
96057 silly gunzTarPerm modified mode [ 'array/intersection.js', 420, 436 ]