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 / app.js
Created August 14, 2012 19:17
The old Kernel code using .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);
}
@Rockncoder
Rockncoder / code.js
Created August 3, 2012 21:35
JQM Resize - the JavaScript code file
"use strict";
var $, navigator, window;
function getDimensions() {
// the iphone specific code is kind of kludgy, if you have a better way let me know
var isIPhone = (/iphone/gi).test(navigator.appVersion),
iPhoneHeight = (isIPhone ? 60 : 0),
width = $(window).width(),
height = $(window).height(),
@Rockncoder
Rockncoder / index.html
Created August 3, 2012 21:33
JQM Resize - body of the index.html file
<body>
<div id="page1" data-role="page" data-rockncoder-jspage="page1">
<!-- the resize code takes into account whether or not there are headers and footers -->
<header data-role="header" data-position="fixed">
<h1>Index Page</h1>
</header>
<section id="content" data-role="content">
<div id="flexDiv" ></div>
</section>
<footer data-role="footer" data-position="fixed">
@Rockncoder
Rockncoder / index.html
Created July 11, 2012 14:29
JQMImageScalePan - using iScroll 4 to pan and HTML to scale an image
<!DOCTYPE html>
<html>
<head>
<title>JQMImageScalePan</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
<link href="content/jquery.mobile-1.1.0.min.css" rel="stylesheet" type="text/css" />
<link href="content/style.css" rel="stylesheet" type="text/css" />
<script src="scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
@Rockncoder
Rockncoder / app.js
Created July 11, 2012 14:28
JQMImageScalePan - using iScroll 4 to pan and HTML to scale an image
// Next two lines for JS-Lint, first a pragma instruction, then global vars specified
"use strict";
var $, iScroll, document, alert, navigator;
// create our own namespace
var RocknCoder = RocknCoder || {};
RocknCoder.Pages = RocknCoder.Pages || {};
RocknCoder.Pages.Kernel = function (event) {
var that = this,
@Rockncoder
Rockncoder / JQMDimensions.js
Created July 11, 2012 12:08
jQuery Mobile - dynamically size the content area
// determine the size of the jQuery Mobile content area for dynamic sizing
RocknCoder.Dimensions = (function () {
var width, height, headerHeight, footerHeight, contentHeight,
getContentDimensions = function () {
return {
width: width,
height: contentHeight
};
},
init = function () {
@Rockncoder
Rockncoder / PGCamera.js
Created July 11, 2012 12:01
PhoneGap camera device getPicture()
RocknCoder.Pages.page1 = (function () {
var dims,
// cache the selectors to some DOM elements
$thePicture = $("#thePicture"),
$snapPicture = $("#snapPicture"),
$picFrame = $("#picFrame"),
// once the image is loaded, get its dimensions
picLoaded = function () {
var width, height;
@Rockncoder
Rockncoder / app.js
Created July 2, 2012 15:05
PGCompass - PhoneGap, jQuery Mobile, and the compass device
// next two lines for JS-Lint
"use strict";
var $, navigator, alert, document;
// create our namespace
var RocknCoder = RocknCoder || {};
// event handlers for the compass stuff,
// one for updating the header text
// the other for rotating the compass
@Rockncoder
Rockncoder / index.html
Created July 2, 2012 15:03
PGCompass - PhoneGap, jQuery Mobile, and the compass device
<!DOCTYPE html>
<html>
<head>
<title>pg-compass</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
<link href="content/jquery.mobile-1.1.0.min.css" rel="stylesheet" type="text/css" />
<link href="content/style.css" rel="stylesheet" type="text/css" />
@Rockncoder
Rockncoder / narrowSelectors.js
Created June 26, 2012 08:11
PhoneGap + JQM Performance Tip #3: Narrow jQuery Selectors
pageshow = function () {
$entryLine = $("#entryLine", $.mobile.activePage);
$li = $("#paperTape li"),
myRow = RocknCoder.RowList.getCurrentRow();