Skip to content

Instantly share code, notes, and snippets.

View nandiraju's full-sized avatar
:octocat:
Geeking

Srikanth nandiraju

:octocat:
Geeking
View GitHub Profile
/* Kosso : March 12th 2011
This the only way I managed to do this without the app crashing on resume.
Done slightly differently to the KS example, since they unregister the service and
do not use a setInterval timer.
*/
//############ in app.js :
// test for iOS 4+
//////////////////////push_notifications.js///////////////////////
var apns = function(){
var pref = require('preferences').preferences;
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT
],
success:function(e)
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
var scrollView = new Y.ScrollView({
srcNode: '#resultList',
height: 260,
flick: {
minDistance:1,
minVelocity:0.4,
axis: "y"
},
deceleration: 0.983,
bounce:0.65,
@nandiraju
nandiraju / pinchzoom.js
Last active December 26, 2015 14:59
pinchzoom
var scrollView = Titanium.UI.createScrollView({
contentWidth: 'auto',
contentHeight: 'auto',
top: 0,
bottom: 0,
showVerticalScrollIndicator: true,
showHorizontalScrollIndicator: true,
@nandiraju
nandiraju / JavaScriptGrid.js
Last active December 26, 2015 14:59
JavaScript Grid
function matrix(rows, cols, defaultValue) {
var arr = [];
for (var i = 0; i < rows; i++) {
arr.push([]);
arr[i].push(new Array(cols));
for (var j = 0; j < cols; j++) {
arr[i][j] = defaultValue;
}
}
return arr;
@nandiraju
nandiraju / app.js
Last active December 26, 2015 09:29 — forked from dawsontoth/app.js
Titanium store remote file on local device
var iconStore = Ti.Filesystem.applicationDataDirectory + '/CachedRemoteImages';
var dir = Ti.Filesystem.getFile(iconStore);
if (!dir.exists()) {
dir.createDirectory();
}
function cacheRemoteURL(image, imageURL) {
if (imageURL) {
var hashedSource = Ti.Utils.md5HexDigest(imageURL + '') + '.' + imageURL.split('.').pop();
var localIcon = Ti.Filesystem.getFile(iconStore, hashedSource);
if (localIcon.exists()) {
@nandiraju
nandiraju / PICASSA_EXAMPLE.html
Last active December 26, 2015 06:09 — forked from arthurnn/gist:1204385
PICASS JQUERY EXAMPLE
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
var json_Album_URI = "https://picasaweb.google.com/data/feed/base/"
+ "user/" + "thewoodsmyth"
+ "?alt=" + "json"
+ "&kind=" + "album"
@nandiraju
nandiraju / CustomEventExample.js
Last active December 26, 2015 03:49
Custom event using Jquery
function customEventExample() {
$('body').bind('custom_event', function(e, data) {
var data = data || e.data;
console.log("This is data." + data.init);
});
$("body").trigger('custom_event', {
init : true
});
<!DOCTYPE html>
<html>
<head>
<link href="ext-touch.css" rel="stylesheet">
<style>
#h_panel {
min-width: 2000px;
background-color: #f5f5f5;
border: 1px solid black;
}