This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 += ' '; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Teset</title> | |
</head> | |
<body> | |
<button onclick="notifyMe()">Notify me!</button> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var connect = require('connect'); | |
connect.createServer( | |
connect.static(__dirname) | |
).listen(8088); | |
console.log('Server started on port 8088'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |