Skip to content

Instantly share code, notes, and snippets.

@justinobney
justinobney / justin_time.js
Created November 9, 2011 22:08
This validates and returns various different time values in javascript
//Author: Justin Obney
//This should return an array with validity and other info
// pass = [true, date object, regex match array, date object toString (for testing) ]
// fail = [false, "error message"]
// should return valid date objects the following:
// 8:00am -standard w/ no preceding "0"
// 09:00am -standard w/ preceding "0"
// 7:13p -matches p to "PM"
// 14:35 -accepts 24 hour time
@justinobney
justinobney / qrcodebookmarklet.js
Created November 17, 2011 14:46
QR Code Generator Bookmarklet
javascript: (function () {
if (document.body) {
var b = window.location.href,
a = '';
var c = prompt("Define", b);
if (c) {
if (c.length) {
a = "http://qrcode.kaywa.com/img.php?s=8&d=" + encodeURIComponent(c.replace(" ", "+"));
window.open(a, "QRcode", "menubar = 1, resizable = 1, width = 320, height = 320 ")
@justinobney
justinobney / jquery.telephonify.js
Created November 17, 2011 19:51
Converts telephone numbers on a page to "tel:#" links for opening via a pc-phone
(function($) {
$.fn.Telephonify = function() {
var patt = /\(?[2-9]\d{2}\)?[- ]?\d{3}[- ]?\d{4}/gi;
return this.each(function() {
var el = $(this);
var html = el.html();
var result = html.match(patt);
@justinobney
justinobney / QUnit.makeArray.js
Created December 19, 2011 18:23
Would like to add "makeArray" to QUnit. This will hopefully allow me to compare objects to arrays for equality.
function makeArray(array, results) {
var ret = results || [];
function merge(first, second) {
var i = first.length,
j = 0;
if (typeof second.length === "number") {
for (var l = second.length; j < l; j++) {
first[i++] = second[j];
@justinobney
justinobney / jsloader.js
Created February 24, 2012 21:21
Simple Javascript & CSS Loader
var Loader = {};
(function (app) {
app.LinkCSS = function (href) {
//Link the stylesheet needed.
var headID = document.getElementsByTagName("head")[0];
var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = href;
@justinobney
justinobney / executeAfter.jQuery.js
Created February 28, 2012 16:39
Wait for a set of AJAX calls to finish before running a callback
/*
* jQuery executeAfter extention
* stole this from: [CHAD] http://stackoverflow.com/users/54746/chad
* SO URL: http://stackoverflow.com/questions/2768293/waiting-on-multiple-asynchronous-calls-to-complete-before-continuing
*/
;(function($) {
$.fn.executeAfter = function(methods, callback) {
var stack = [];
/**
This file is placed at the top of every page
inheriting from BasePage.vb, thus all the following
functions are available from thos pages.
*/
/** @namespace */
var PMSApp = PMSApp || {};
(function (app) {
/** @public */
@justinobney
justinobney / mellobar.jquery.js
Created May 31, 2012 19:19
JS: MelloBar // HelloBar Rip Off via jQuery
/*
Author: Justin Obney
Website: http://justinobney.com
Example: http://jsfiddle.net/justinobney/aeyqR/
*/
;
(function($, window, undefined) {
var pluginName = 'mellowBar',
document = window.document,
@justinobney
justinobney / request-load-timer.js
Created June 13, 2012 17:02
use cookies to test page request and load times
var app = app || {};
app.cookie = {
create: function (name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
} else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
@justinobney
justinobney / backstretch.jquery.js
Created June 14, 2012 21:20
Full Screen Background Image
(function (a) {
a.backstretch = function (k, i, l) {
function m(c) {
try {
f = {
left: 0,
top: 0
};
d = e.width();