Skip to content

Instantly share code, notes, and snippets.

View muhammadghazali's full-sized avatar

Muhammad Ghazali muhammadghazali

View GitHub Profile
@defunkt
defunkt / clients.md
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
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ 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 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
@Jxck
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
* https://github.com/joyent/node/wiki/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
coolaj86 / how-to-publish-to-npm.md
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!

Updated:

  • 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
macdonst / tweets.js
Created December 21, 2011 19:50
Load Tweets
function loadTweets() {
var request = new XMLHttpRequest();
request.open("GET", "http://search.twitter.com/search.json?q=phonegap", 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
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
cocoahero / README.md
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

MANIFEST="AndroidManifest.xml"

if [ -f $MANIFEST ]
@kivi
kivi / collecttion-json-template-options.md
Created August 21, 2012 12:20 — forked from mrdevinmob/collecttion-json-template-options.md
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
joshdholtz / SomeFragment.java
Last active December 22, 2022 09:41
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);