Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (C) 2014 Antonio Leiva Gordillo.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
//1 . Modify your MainActivity section in AndroidManifest.xml, delete from it, line with MAIN category in intent-//filter section
<activity android:name="ru.quickmessage.pa.MainActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/CustomTheme"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@manishkpr
manishkpr / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../paper-slider/paper-slider.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
@manishkpr
manishkpr / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@manishkpr
manishkpr / Swift JSON Parsing From String.swift
Last active December 30, 2016 14:08
Swift JSON Parsing From String
let jsonString = "{\"id\":123,\"Name\":\"Munish\"}"
// convert String to NSData
var data: NSData =jsonString.dataUsingEncoding(NSUTF8StringEncoding)!
var error: NSError?
// convert NSData to 'AnyObject'
<?php
//## Function to send GCM push notification
function sendMessageUsingGCM($registatoin_ids, $message) {
//## Google cloud messaging GCM-API url
$url = 'https://android.googleapis.com/gcm/send';
$fields = array( 'registration_ids' => $registatoin_ids, 'data' => $message,);
//## Update your Google Cloud Messaging API Key
@manishkpr
manishkpr / AppDelegate.swift
Created August 26, 2015 01:20
iOS-Swift Open AlertView Dialog From AppDelegate (UIApplicationDelegate)
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
@manishkpr
manishkpr / AddJsonObjectToJSONArray.java
Last active August 31, 2015 06:08
Adding or Appending JsonObject to Jsonarray in java
String jsonData = "{\"results\":[{\"lat\":\"value\",\"lon\":\"value\" }]}";
System.out.println(jsonData);
try {
JSONArray result = new JSONObject(jsonData).getJSONArray("results");
result.getJSONObject(0).put("city","Singapore");
jsonData = "{\"results\":"+result.toString()+"}";
System.out.println(jsonData);
} catch (JSONException e) {
e.printStackTrace();
}
@manishkpr
manishkpr / activity_main.xml
Created November 11, 2015 02:53
Andriod Material Tabs
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.webheavens.manishkprmaterialtabs.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"