Skip to content

Instantly share code, notes, and snippets.

@smurfpandey
smurfpandey / API.md
Created April 3, 2013 14:35 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

/*! ******************************
Handlebars helpers
*******************************/
// debug helper
// usage: {{debug}} or {{debug someValue}}
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/)
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
/*! ******************************
Handlebars helpers
*******************************/
// debug helper
// usage: {{debug}} or {{debug someValue}}
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/)
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
@smurfpandey
smurfpandey / web.config
Last active March 18, 2017 02:23 — forked from Blackmist/gist:6701556
web.config for running node.js applications inside IIS with IISNode
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode" />
</handlers>
<iisnode node_env="production" />
<rewrite>
<rules>
<rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
var apn = require('apn');
var token = "<token here>";
var service = new apn.connection({
maxConnections: 1
});
service.on("completed", function() { console.log("Completed!")});
service.on("connected", function() { console.log("Connected"); });
public static void postNewComment(Context context,final UserAccount userAccount,final String comment,final int blogId,final int postId){
mPostCommentResponse.requestStarted();
RequestQueue queue = Volley.newRequestQueue(context);
StringRequest sr = new StringRequest(Request.Method.POST,"http://api.someservice.com/post/comment", new Response.Listener<String>() {
@Override
public void onResponse(String response) {
mPostCommentResponse.requestCompleted();
}
}, new Response.ErrorListener() {
@Override
@smurfpandey
smurfpandey / cordova-file-io.js
Created March 3, 2017 10:52
Write data to file using cordova file plugin.
var fnCreateDirectoryInFileSystem = function (rootPath, newFolderName) {
var deferred = Q.defer();
var fnDirFail = function (err) {
//Root path missing
deferred.reject();
};
var fnGotDir = function (dirEntry) {
//Create the first directory
@smurfpandey
smurfpandey / cordova-file-io.js
Created March 3, 2017 10:53
Write data to file using cordova file plugin. This snippet uses promise using q.js
var fnCreateDirectoryInFileSystem = function (rootPath, newFolderName) {
var deferred = Q.defer();
var fnDirFail = function (err) {
//Root path missing
deferred.reject();
};
var fnGotDir = function (dirEntry) {
//Create the first directory

Keybase proof

I hereby claim:

  • I am smurfpandey on github.
  • I am smurfpandey (https://keybase.io/smurfpandey) on keybase.
  • I have a public key ASCbfGueVeyocfyhiVnXddRvg8WSz3c5cGnZeZ3ctB5HQAo

To claim this, I am signing this object: