Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{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'}, |
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 ]
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".
-
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.
-
Add an optional property to the
data
object: multiple (boolean).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
OlderNewer