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 May 22, 2012 07:35
JQMResponsive: Responsive Design in jQuery Mobile: JS File
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 / stylemedia.js
Created May 22, 2012 08:55
JQMResponsive: Responsive Design in jQuery Mobile: snippet file
if(window.styleMedia.matchMedium("screen and (max-width: 480px)")){
alert("In mobile mode");
}
@Rockncoder
Rockncoder / viewDidLoad.m
Created May 25, 2012 13:40
AdMobCalculator
// Create a view of the standard size at the bottom of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
// Must be a better way to position at bottom of page
[bannerView_ setCenter:CGPointMake(kGADAdSizeBanner.size.width/2, 435)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
RocknCoder.Pages.managePlotChart = function () {
var pageshow = function () {
updateChart();
$("#refreshPlotChart").click(function(){
updateChart();
$.mobile.silentScroll();
});
},
pagehide = function () {
$("#refreshPlotChart").unbind('click');
RocknCoder.Pages.manageBarChart = function () {
var pageshow = function () {
updateChart();
$("#refreshBarChart").click(function(){
updateChart();
});
},
pagehide = function () {
$("#refreshBarChart").unbind('click');
},
@Rockncoder
Rockncoder / index.html
Created May 28, 2012 22:49
JQMCharts
<!DOCTYPE html>
<html>
<head>
<title>JQM Charts</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/jquery.jqplot.css" rel="stylesheet" type="text/css" />
<script src="scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
@Rockncoder
Rockncoder / app.js
Created June 4, 2012 02:49
JQMCalculator main JavaScript file 2012-06-03
/*
** jQuery Mobile Calculator
**
*/
var RocknCoder = RocknCoder || {};
RocknCoder.Pages = RocknCoder.Pages || {};
// handles all of the page events and dispatches them to a handler, if one exists
RocknCoder.Pages.Kernel = function (event) {
@Rockncoder
Rockncoder / twitter.js
Created June 12, 2012 19:28
JQMTwitter - Twitter Search API call
// create our namespace
var RocknCoder = RocknCoder || {};
// this is the object that takes care of all of our twitter business
RocknCoder.Tweet = function () {
var searchTerm = "",
$appendTo,
tmpl = "",
numTweets = 10,
@Rockncoder
Rockncoder / eventHandler.js
Created June 26, 2012 08:04
PhoneGap + JQM Performance Tip #1: Prevent Default Event Behavior
var pageshow = function () {
RocknCoder.Display.init($("#displayControl")[0]);
$("button").tap(function(event){
var key = $(this).attr("data-rockncoder-tag"),
id = this.id;
event.preventDefault();
switch(id){
case "key0":
case "key1":
@Rockncoder
Rockncoder / cacheSelectors.js
Created June 26, 2012 08:09
PhoneGap + JQM Performance Tip #2: Cache jQuery Selectors
var $paperTape = $("#paperTape"),
$li = $("#paperTape li"),
$sum = $("#sum"),
height = parseInt($li.css("height"),10),
top = RocknCoder.Dimensions.top,
getTop = function(){
return top;
};