Skip to content

Instantly share code, notes, and snippets.

View saumya's full-sized avatar

saumya saumya

View GitHub Profile
@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");
@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 / 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 / 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 / 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>
//
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();
});
package
{
import com.saumya.study.MyProxyObject;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.Proxy;
import flash.utils.flash_proxy;
package com.saumya.study
{
import flash.utils.Dictionary;
import flash.utils.Proxy;
import flash.utils.flash_proxy;
/**
* Learning the proxy object
* @author saumya
* @version 0.0.1
@saumya
saumya / commandLine1.dart
Created January 16, 2013 10:33
A basic dart file to show most of the basics of the dartlang.
void main() {
//print("Hello, World!");
num a=24;
printNumber(a);
var b=45;//declaring without a type declaration, but you can see assigning a string to this will throw compile time error
printNumber(b);
Joe j=new Joe();
//print(j.age);//can not access private var
print('j is of ${j.userAge}');//getter
j.userAge=30;//setter
@saumya
saumya / coffeeScriptBasic.coffee
Created January 31, 2013 18:29
A basic implementation of CoffeeScript with jQueryMobile
#jQuery ->
# console.log "DOM Ready : 1 : Hello World"
#jQuery(document).ready ->
# console.log "DOM Ready : 2 : "
#jQuery(window).load ->
# console.log "DOM Ready : 3 : "
#jQuery Mobile
jQuery(document).on 'pageinit', ->
console.log 'Coffe Script says : Page initialised !'