Skip to content

Instantly share code, notes, and snippets.

View Rockncoder's full-sized avatar
💭
A coder's got to code

RocknCoder Rockncoder

💭
A coder's got to code
View GitHub Profile
@Rockncoder
Rockncoder / index.html
Created January 22, 2013 06:59
RNC Slide Panel in HTML.
<body>
<div id="page1" data-role="page" data-rockncoder-jspage="page1">
<header data-role="header">
<h1>RNC Slide Panel</h1>
</header>
<section data-role="content" style="margin: 25px;">
<div>This app doesn't do anything.</div>
</section>
<!-- panels always start hidden -->
<div id="panel" class="panel" >
@Rockncoder
Rockncoder / jquery.slidepanel.js
Created January 22, 2013 06:58
Init method of RNC Slide Panel.
Plugin.prototype = {
init:function () {
var that = this;
this.$ptr.css(this.options.side, this.collapsedX + 'px');
this.$ptr.css('top', this.options.top);
/* hook the click/tap event */
this.$ptr.click(function (evt) {
/* only activate if clicking on the panel not something on the panel */
if (event.target.id === that.$ptr.attr('id')) {
@Rockncoder
Rockncoder / home.html
Created January 21, 2013 08:32
A simple way to handle PhoneGap/jQueryMobile deviceready issue.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.mobile-1.2.0.min.css" />
<script type='text/javascript' src='libs/jquery-1.8.3.js'></script>
<script type='text/javascript' src="js/custom-script.js"></script>
<script type='text/javascript' src="libs/jquery.mobile-1.2.0.min.js"></script>
@Rockncoder
Rockncoder / index.html
Created January 21, 2013 08:25
A simple way to handle PhoneGap/jQueryMobile deviceready issue. Index.html file.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title></title>
</head>
<body>
var Calc = {};
Calc.Logic = function () {
var operator,
displayControl = "",
operatorSet = false,
equalsPressed = false,
accumulator = null,
@Rockncoder
Rockncoder / NewApplicationWindow.js
Created January 5, 2013 17:26
The ApplicationWindow.js after moving the KeyPad out. (also note the changing of the comment style)
/* Application Window Component Constructor */
function ApplicationWindow() {
/* create component instance */
var self = Ti.UI.createWindow({
backgroundColor:'#000000'
});
return self;
}
/* make constructor function the public component interface */
@Rockncoder
Rockncoder / OriginalApplicationWindow.js
Created January 5, 2013 17:20
Original version of ApplicationWindow.js
//Application Window Component Constructor
function ApplicationWindow() {
//load component dependencies
var KeyPad = require('ui/common/KeyPad');
//create component instance
var self = Ti.UI.createWindow({
backgroundColor:'#000000'
});
@Rockncoder
Rockncoder / KeyPad.js
Created December 31, 2012 15:47
Titanium Calculator app, keypad module
function KeyPad() {
var isIOS = (Ti.Platform.osname === 'iphone' || Ti.Platform.osname === 'ipad'),
self = Ti.UI.createView({
width: '80%',
height: '80%',
top: '15%',
left: '10%',
backgroundColor:'#000'
}),
display = Ti.UI.createLabel({
@Rockncoder
Rockncoder / app.js
Created August 14, 2012 19:32
The new Kernel no need for .live()
var RocknCoder = RocknCoder || {};
RocknCoder.Pages = RocknCoder.Pages || {};
// put all of the page events into one string
RocknCoder.PageEvents = "pagebeforeshow pageshow pagebeforechange pagechange pagebeforehide pagehide";
// the kernel remains unchanged
RocknCoder.Pages.Kernel = function (event) {
var that = this,
eventType = event.type,
pageName = $(this).attr("data-rockncoder-jspage");
@Rockncoder
Rockncoder / app.js
Created August 14, 2012 19:19
The old Kernel code used .live()
var RocknCoder = RocknCoder || {};
RocknCoder.Pages = RocknCoder.Pages || {};
RocknCoder.Pages.Kernel = function (event) {
var that = this,
eventType = event.type,
pageName = $(this).attr("data-rockncoder-jspage");
if (RocknCoder && RocknCoder.Pages && pageName && RocknCoder.Pages[pageName] && RocknCoder.Pages[pageName][eventType]) {
RocknCoder.Pages[pageName][eventType].call(that);