Skip to content

Instantly share code, notes, and snippets.

View saumya's full-sized avatar

saumya saumya

View GitHub Profile
@saumya
saumya / ubuntuBoxSetupTricks
Last active April 26, 2017 06:45
Ubuntu setup and tricks
# Installation and some details
==================================================================================
If android is installed with Android Studio then the path to sdk is at
` ~/Android/sdk/ `
==================================================================================
## NodeJS :
//
var express = require('express');
var app = express();
app.all('*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
next();
});
@saumya
saumya / kii_servercode_deploy
Created April 18, 2014 11:19
deploying servercode to Kii Cloud platform. Note, this is only servercode deploy not with Hook.
node bin/kii-servercode.js deploy-file --file path/to/myServerCode.js --site us --app-id <AppID> --app-key <AppKey> --client-id <ClientID> --client-secret <ClientSecret>
@saumya
saumya / MainViewController.m
Created March 21, 2014 09:43
Cordova(Phonegap) application, fixing the iOS 7 status bar
- (void)viewWillAppear:(BOOL)animated
{
// View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView),
// you can do so here.
//Original
//[super viewWillAppear:animated];
//Fix for Cordova on iOS 7
//Lower screen 20px on ios 7
@saumya
saumya / cordova3.4ProjectCreation
Last active April 12, 2016 12:24
Cordova 3.4, iOS project creation and enabling all the plugins. Its the plugman way. First download the Archieve and unzip the native platform (iOS, Android, whihever you want), in this case we focus on iOS. Then follow the commands below.
Ref:
1. http://cordova.apache.org/docs/en/3.4.0/guide_platforms_ios_tools.md.html#iOS%20Command-line%20Tools
2. http://cordova.apache.org/docs/en/3.4.0/plugin_ref_plugman.md.html#Using%20Plugman%20to%20Manage%20Plugins
===================================================================
//From inside the project package
./create path/to/preoject/folder com.package.name ProjectName
===================================================================
//From inside the Cordova project folder
======================================================================================
plugman install --platform ios --project . --plugin org.apache.cordova.battery-status
@saumya
saumya / jqmChangePage.js
Last active August 29, 2015 13:56
jQueryMobile change page API has been changed and seems like there is a problem with the actual page change. Here is snippet which make it work.
//The options object must have set, changeHash:true, as in the first example
//1
$.mobile.pageContainer.pagecontainer("change", "pageID", { reload:true, transition:'flow', changeHash:true });
//alternates
//2
$(":mobile-pagecontainer").pagecontainer("change", "target", { options });
//3
$("body").pagecontainer("change", "target", { options });
@saumya
saumya / myViewController.m
Created February 13, 2014 04:52
Customising the NavBar and ToolBar in a ViewController which is inside a UINavigationViewController
- (void)viewDidLoad
{
//hide backbutton
[self.navigationItem setHidesBackButton:YES];
//hide the complete navigation bar
[self.navigationController setNavigationBarHidden:YES];
//hide tool bar
self.navigationController.toolbarHidden=YES;
}
@saumya
saumya / util.js
Last active August 29, 2015 13:55
BackboneJS : Making an event dispatcher by extending Event
define('social/util',
['dependentLib'],
function(){
var myUtilLib = _.extend({
init: function(){
this.trigger("myUtilLib:init", "init message");
},
destroy: function(){
this.trigger("myUtilLib:destroy", "destroy message");
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@saumya
saumya / AndroidFBHash.java
Last active January 3, 2016 02:59
Android : Print the HashKey required for working with native facebook SDK. On the android project, put this function(copy-paste) on the Main Activity class. Now call this.printFaceBookHash("com.saumya.myNativeApp"); Note: pass on the exact package name of your application. This will print the HashKey on the LogCat output of Eclipse. Not sure if …
private void printFaceBookHash(String packageName){
String mAppPackage = packageName;
try {
PackageInfo info = getPackageManager().getPackageInfo(
mAppPackage, PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", "====================================================");
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));