Skip to content

Instantly share code, notes, and snippets.

View muhammadghazali's full-sized avatar

Muhammad Ghazali muhammadghazali

View GitHub Profile
defunkt /
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

isaacs /
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
Jxck / ecma5_on_v8.js
Created July 9, 2011 12:02
The sample usage of ECMA 5 Features Implemented in V8
* The sample usage of ECMA 5 Mozilla Features Implemented in V8
* You can use thease new feature of ECMA5 on Node.js as you like.
* because there is no IE :)
* Order is deferent form original wiki.
* Sources are Checked on Node.js v0.5.0(unstable), v0.4.9(stable)
* you can execute this file.
* $ node ecma5_on_v8.js
coolaj86 /
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!


  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
macdonst / tweets.js
Created December 21, 2011 19:50
Load Tweets
function loadTweets() {
var request = new XMLHttpRequest();"GET", "", true);
request.onreadystatechange = function() {//Call a function when the state changes.
if (request.readyState == 4) {
if (request.status == 200 || request.status == 0) {
var tweets = JSON.parse(request.responseText);
var data = "<table cellspacing='0'>";
var tableClass;
for (i = 0; i < tweets.results.length; i++) {
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
cocoahero /
Created July 12, 2012 17:05
Android Auto-Versioning w/ Git

It is common practice to make the android:versionCode in the AndroidManifest.xml the build number of the application. An easy build number to calculate is the number of git commits in the repo.

Instead of having to edit the manifest file manually and update the android:versionCode attribute with the build number, below is a git pre-commit hook that does it for you.

#!/usr/bin/env bash


if [ -f $MANIFEST ]
kivi /
Created August 21, 2012 12:20 — forked from mrdevinmob/
collection-json extension template options

Template Options

Support template data options by adding property attribute with an array of text and values. Additionally add a multiple property, which indicates multiple values are suppored if set to "true".

  1. Add an optional property to the data object: options (array of objects. text/value pair)

    • the "text" property would indicate the text to be displayed in client.
    • the "value" property would indicate the value associated with the text above. This is the what the client should return to to the API in a POST or PUT request.
  2. Add an optional property to the data object: multiple (boolean).

joshdholtz /
Last active December 22, 2022 09:41
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);