Skip to content

Instantly share code, notes, and snippets.

View steinbring's full-sized avatar

Joe Steinbring steinbring

View GitHub Profile
@steinbring
steinbring / index.html
Last active December 18, 2015 13:38
*Detect dimensions of the client device within JavaScript* So, you want to do something based upon the device type and you can't use CSS-based conditions or the client's user-agent string? You could always use the dimensions of the browser window. Source of screen dimension info: http://www.metaltoad.com/blog/simple-device-diagram-responsive-des…
<html>
<head>
<title>What type of device am I using?</title>
</head>
<body>
<!-- Show the window width -->
<div id="WinWidth"></div>
<!-- Show the window height -->
<div id="WinHeight"></div>
<!-- Show the device type -->
@steinbring
steinbring / pagination.cfm
Created December 17, 2012 01:43
How to do pagination within ColdFusion This is an example of how to handle pagination in ColdFusion. This simple example can be manipulated by changing the values of the four variables at the top of the file.
<!--- How many pages should you link to at any one time? --->
<cfset intPagesToLinkTo = 5>
<!--- How many items are you displaying per page? --->
<cfset intItemsPerPage = 10>
<!--- How many items do you need to display, across all pages. --->
<cfset intNumberOfTotalItems = 100>
<!--- What is the current page you are on? --->
<cfif isdefined("url.page")>
<cfset intCurrentPage = val(url.page)>
<cfelse>
@steinbring
steinbring / JavaScriptRSSReader.html
Created December 3, 2012 00:42
How to consume and display RSS in JavaScript
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>How to display RSS via JavaScript</title>
<!-- jQuery CDN -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<script type="text/javascript">
@steinbring
steinbring / StoreFormValuesInLocalStorage-Part1.html
Created November 18, 2012 01:35
How to use localStorage and sessionStorage to make form values persistant
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="windows-1252">
<title>Keep webform data persistent</title>
<!-- jQuery CDN -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style type="text/css">
/*Float the form labels to the left and allow them 40% of the width of the form*/
@steinbring
steinbring / StoreArraysInLocalStorage-Part1.html
Created November 12, 2012 00:36
How to store values in localStorage (a persistent place to store data in JavaScript)
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="windows-1252">
<title>Experiment into client-side value storage</title>
<script type="text/javascript">
// Does your browser support localstorage?
if(typeof(Storage)=="undefined")
{