Skip to content

Instantly share code, notes, and snippets.

View amolc's full-sized avatar
🎯
Focusing

Amol amolc

🎯
Focusing
View GitHub Profile
@amolc
amolc / vptest.info
Created March 14, 2012 03:24 — forked from voxpelli/vptest.info
OAuth.module 3.x example - a test I made to verify the D7 port of the module - should work well on D6 as well though
name = VoxPelli OAuth Test
core = 7.x
dependencies[] = oauth_common
dependencies[] = http_client
@amolc
amolc / rest_api.js
Created December 29, 2013 14:30 — forked from erichonorez/rest_api.js
Simple Rest API
/**
* TaskRepository class deals with task persistence
*/
function TaskRepository() {
this.tasks = [];
this.nextId = 1;
}
/**
* Find a task by id
* Param: id of the task to find
appView.addJavascriptInterface(this, "MyJSI");
@JavascriptInterface
public void foo() { .... }
(in onDeviceReady)
if (window.MyJSI == undefined) console.log("javascript interface is undefined");
else if (window.MyJSI == null) console.log("javascript interface is null");
CREATE TABLE IF NOT EXISTS country ( iso CHAR(2) NOT NULL PRIMARY KEY, name VARCHAR(80) NOT NULL, printable_name VARCHAR(80) NOT NULL, iso3 CHAR(3), numcode SMALLINT ); INSERT INTO country VALUES ('AF','AFGHANISTAN','Afghanistan','AFG','004'); INSERT INTO country VALUES ('AL','ALBANIA','Albania','ALB','008'); INSERT INTO country VALUES ('DZ','ALGERIA','Algeria','DZA','012'); INSERT INTO country VALUES ('AS','AMERICAN SAMOA','American Samoa','ASM','016'); INSERT INTO country VALUES ('AD','ANDORRA','Andorra','AND','020'); INSERT INTO country VALUES ('AO','ANGOLA','Angola','AGO','024'); INSERT INTO country VALUES ('AI','ANGUILLA','Anguilla','AIA','660'); INSERT INTO country VALUES ('AQ','ANTARCTICA','Antarctica',NULL,NULL); INSERT INTO country VALUES ('AG','ANTIGUA AND BARBUDA','Antigua and Barbuda','ATG','028'); INSERT INTO country VALUES ('AR','ARGENTINA','Argentina','ARG','032'); INSERT INTO country VALUES ('AM','ARMENIA','Armenia','ARM','051'); INSERT INTO country VALUES ('AW','ARUBA','Aruba','ABW','533'); I
@amolc
amolc / GCM Working COde
Created October 19, 2014 04:13
GCM Notificaton Alert
// handle GCM notifications for Android
onNotificationGCM = function(e){
alert('onGCM');
switch( e.event )
{
case 'registered':
if ( e.regid.length > 0 )
{
console.log("Regid " + e.regid);
//Do registration work here...
var apn = require('apn');
//var token = "ce1c081e03ad5c16aa400756f274e753ec0b52b0d32ab6e10de5962f2d0393c6";
var token = "01f48c1d1159f3a0b3bd7da1d2481f90a51e0b03804a1adc203010e0750f5226" ;
var device = new apn.Device(token);
var notification = new apn.Notification();
notification.expiry = Math.floor(Date.now() / 1000) + 3600;
notification.badge = Number(1) || 0;
notification.alert = "This is a Push Notification=)";
@amolc
amolc / gist:cb0f08c1cd204ac24697
Created January 28, 2015 08:13
GCM Nodejs script
var gcm = require('node-gcm');
// Create a message
// ... with default values
var message = new gcm.Message();
// ... or some given values
var message = new gcm.Message({
collapseKey: 'demo',
delayWhileIdle: true,
@amolc
amolc / payment.php
Created March 3, 2015 03:40
Deplayed Payment
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="img/favicon.png">
@amolc
amolc / addinguidtogig.php
Created March 4, 2015 05:52
Gig uid to gig table
/* Code Brief
------
Get the gig id
$uids = select userId_bids from gig where gigid=XXX
append the new uid
$uids = $uids +"," newuid ;
@amolc
amolc / gitmerge.sh
Last active August 29, 2015 14:16
git merge 2 branches smartly
git branch -m master master-old # rename master on local
git push origin :master # delete master on remote
git push origin master-old # create master-old on remote
git checkout -b master dev # create a new local master on top of dev
git push origin master # create master on remote