Skip to content

Instantly share code, notes, and snippets.

View steinbring's full-sized avatar

Joe Steinbring steinbring

View GitHub Profile
@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")
{
@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 / 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 / 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 / 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 / UseVocabulary.cfm
Created September 2, 2013 20:03
This is an experiment in the dynamic population of a variable scope, based upon the content within a table. It could be really useful for the localization of content.
<cfsilent>
<cfif isDefined("url.language")>
<cfquery name="VocabQuery" datasource="erp">
select vcName as name,
vcValue as value,
vcLanguage as language
from tblVocab
where vcLanguage = <cfqueryparam cfsqltype="cf_sql_varchar" value="#url.language#">
</cfquery>
<cfset variables.vocabulary = StructNew()>
@steinbring
steinbring / DecimalToBinary.htm
Last active December 27, 2015 23:09
This very simple HTML + JavaScript app converts decimal numbers to unsigned binary and back again. It can handle values from 0 to 2^64/2. I mostly just did this because I was curious. I doubt it would have much value beyond a CS class or something.
<!--
Joe Steinbring
http://steinbring.net
11/10/2013
-->
<html>
<head>
<title>Decimal to Binary Converter</title>
</head>
<body>
@steinbring
steinbring / WithAccept.cfm
Last active January 3, 2016 15:19
I've been having trouble with cffile on a particular website. I created this as a test of a hypothesis. I think cffile's accept attribute is borked on CF10. I tested it on CentOS/Apache/CF10 Standard and localhosted on Win7. Go to http://steinbring.net for the explanation.
<form method="post" enctype="multipart/form-data">
<input name="theFile" type="file">
<input name="submitButton" name="submit" type="submit" value="Upload">
</form>
<cfif isDefined("form.theFile")>
<!--- Is there a file? Upload it to the files folder. --->
<cffile action="upload"
filefield="theFile"
accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
@steinbring
steinbring / PocketJoe.html
Last active January 4, 2016 15:29
This is meant to be a very basic jQuery/HTML/CSS RSS reader. It uses YQL to turn the XML feed into a JSON feed that the browser's origin limits are alright with.
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Pocket Joe</title>
<!-- jQuery CDN -->
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<!-- jQuery UI CDN -->
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<!-- A jQuery UI CSS -->
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
@steinbring
steinbring / PocketJoe.html
Created February 6, 2014 05:21
Pocket Joe 0.02 - This is a sample Android app that I created, to help teach myself PhoneGap. More info is available at: http://steinbring.net/2014/pocket-joe-revisited-joe-evolves-his-phonegap-skills/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Pocket Joe</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.mobile-1.4.0.min.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile-1.4.0.min.js"></script>