Skip to content

Instantly share code, notes, and snippets.

View muhammadghazali's full-sized avatar

Muhammad Ghazali muhammadghazali

View GitHub Profile
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@muhammadghazali
muhammadghazali / index.js
Created June 2, 2015 14:35
requirebin sketch
var moment = require('moment');
var today = moment().startOf('day');
console.log("today ", moment().startOf('day'));
console.log("tomorrow ", moment(today).add(1, 'days'));
var day = moment().unix() * 1000;
var dayInISO = moment().millisecond(moment().unix());
console.log(dayInISO.format());
console.log("Today in ISO ", moment().format());
console.log("Today ", moment());
// To disable socket.io, disable the sockets hook (you'll have to disable the pubsub hook as well)
// This is a replacement for the default app.js file:
require('sails').lift({
hooks: {
sockets: false,
pubsub: false
}
@muhammadghazali
muhammadghazali / testrunner.html
Last active September 4, 2015 18:51 — forked from jonnyreeves/testrunner.html
Unit Testing Promises with Sinon.js
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
<!-- when.js Promises implementation -->
<script src="https://raw.github.com/cujojs/when/master/when.js"></script>
<!-- Unit testing and mocking framework -->
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
@muhammadghazali
muhammadghazali / about.md
Created August 13, 2011 10:48 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@muhammadghazali
muhammadghazali / nodejs_ubuntu_setup.sh
Created October 29, 2011 11:52
Node.js installation script for Ubuntu Linux. This installation script is already tried on my Ubuntu 11.04 Linux Box.
# The official wiki page for Building and Installing Node.js
# https://github.com/joyent/node/wiki/Installation
# Update the system
echo 'Update the system'
sudo apt-get -y udpate
echo 'System updated'
# Install the dependencies packages
echo 'Install the dependencies packages'
@muhammadghazali
muhammadghazali / installdotnavefor_blaastsdk.sh
Created October 29, 2011 12:44
Failed to start backend process because there is no such a directory of "/home/user/.nave/installed/0.4.7/bin/node"
# The discussion:
# http://devsupport.blaast.com/discussions/problems/48-failed-to-start-backend-process-because-there-is-no-such-a-direcotry-of-homeghazalinaveinstalled047binnode
# The error message:
# Failed to start backend process: Cannot run program "home/user/.nave/installed/0.4.7/bin/node": java.io.IOException: error=2, No such File or Directory.
# The work around works with these steps:
# I have to create a directory ".nave/installed" in my user home directory
cd ~
mkdir .nave/installed
$ git tag -a v1.0.0 -m "Creating the first official version."
$ git show v1.0.0
$ git describe --tags
# Made changes
$ touch test
# Added changes
@muhammadghazali
muhammadghazali / PostHtmlFormNetBeansCodeTemplate
Created December 25, 2011 19:21
Code Template for post HTML form in NetBeans
<form name="${name}" id="${id}" method="post" action="${action}" >
${cursor}
</form>
@muhammadghazali
muhammadghazali / GetHtmlFormNetBeansCodeTemplate
Created December 27, 2011 17:13
Code Template for get HTML form in NetBeans
<form name="${name}" id="${id}" method="get" action="${action}" >
${cursor}
</form>