Skip to content

Instantly share code, notes, and snippets.

@TerryMooreII
TerryMooreII / jquery-mobile.getHashtagParameters.js
Last active December 20, 2015 07:09
Jquery mobile. Pass data from hashtag page links with in jquery mobile Ex #newPage?key=value&key2=asdf. This is by no means a final product but it gets the job done.
var params;
// Listen for any attempts to call changePage().
$(document).bind( "pagebeforechange", function( e, data ) {
if ( typeof data.toPage === "string" ) {
var u = $.mobile.path.parseUrl( data.toPage );
var re = /^#/;
var question = u.hash.indexOf('?');
if ( u.hash.search(re) !== -1 && question !== -1 )
@TerryMooreII
TerryMooreII / hs-football-player-of-the-week.js
Last active December 23, 2015 07:39
Um, my mom requested this. A script to vote for my cousin so that he can player of the week. I really don't feel so bad, it looks like two other contestants are doing the same.
(function(){
var count = 0;
var totalVotes = 10;
var interval = 1000; //in milliseconds 1000 = 1 sec
var vote = setInterval(function(){
$('input[value="3997"]').prop('checked', true);
$('form.poll').submit();
console.log("Vote " + count + " Cast")
@TerryMooreII
TerryMooreII / jquery-i18n.html
Last active December 26, 2015 14:19
Sample code for blog
<html>
<body>
<div id="myId">
<span data-i18n="welcome"></span> <!-- Updates the span text with the welcome value from the translation file-->
<input data-i18n="enter_name"> <!-- Updates the placeholder value with enter_name value fro from the translation file-->
</div>
<script src="path/to/jquery"></script>
<script src="path/to/jquery.i18n.js"></script>
<script>
$('body').i18n();
@TerryMooreII
TerryMooreII / deckOfCards.js
Created November 1, 2013 13:03
Deck of Cards
var suites = ['\u2660', '\u2665', '\u2666', '\u2663'];
var numbers = ['2','3','4','5','6','7','8','9','10','J','Q','K','A'];
var buildDeck = function(){
var deck = [];
for (suite in suites)
for (number in numbers)
deck.push(numbers[number] + suites[suite]);
return deck;
}
@TerryMooreII
TerryMooreII / war.js
Last active December 27, 2015 04:39
war
var suites = ['\u2660', '\u2665', '\u2666', '\u2663'];
var numbers = ['2','3','4','5','6','7','8','9','10','J','Q','K','A'];
var buildDeck = function(){
var deck = [];
for (var suite in suites)
for (var number in numbers)
deck.push(numbers[number] + suites[suite]);
return deck;
};
@TerryMooreII
TerryMooreII / barcodesanner.js
Last active December 27, 2015 09:49
barcode scanner - doesnt work....yet :)
<!DOCTYPE html>
<html><head>
<title>Barcode recognition with JavaScript</title>
<script type="text/javascript" src="get_barcode_from_image.js"></script>
<style type="text/css"></style></head>
<video id="video" width="320" height="240" autoplay></video>
<button id="snap">Snap Photo</button>
<canvas id="canvas" width="320" height="240"></canvas>
<button onclick="alert(getBarcodeFromImage('canvas'))">Scan</button>
@TerryMooreII
TerryMooreII / textarea-tab.js
Last active December 31, 2015 04:39
Add Tab support within a text area. In particular Metlifes Synapse site
//Added tab support to Metlife Synapse json resume builder site
$('#json_textarea').on('keydown', function(event){
$this = $(this);
var TAB_SPACES = 2;
var getSpaces = function(){
var space='';
for(var i=0; i<TAB_SPACES; i++){
space += ' ';
@TerryMooreII
TerryMooreII / notify.html
Created January 27, 2014 15:25
HTML5 Notifications examaple
<html>
<head>
<title>Teset</title>
</head>
<body>
<button onclick="notifyMe()">Notify me!</button>
<script type="text/javascript">
@TerryMooreII
TerryMooreII / server.js
Created January 27, 2014 15:25
Simple connect static server.
var connect = require('connect');
connect.createServer(
connect.static(__dirname)
).listen(8088);
console.log('Server started on port 8088');
@TerryMooreII
TerryMooreII / audio-chat.js
Created February 7, 2014 19:47
Messing around with coding a message and sending/receiving it over audio/mic. Doesnt work....yet....
var sen = "The quick brown fox";
function codeMessage(message){
var bin = '';
var message = sen.split('')
for(var i=0; i < message.length; i++){
var letter = message[i];
var code = letter.charCodeAt().toString(2);
bin += new Array( 8-code.length+1 ).join( '0' ) + code;