Skip to content

Instantly share code, notes, and snippets.

View say2joe's full-sized avatar
🏠
Codifying my code; possibly refactoring!

Joseph J. Johnson say2joe

🏠
Codifying my code; possibly refactoring!
View GitHub Profile
@say2joe
say2joe / RallyScrumTaskCreator.js
Last active November 21, 2018 17:57
Rally Scrum Tool: Task Creator Bookmarklet
javascript:if(!Custom)var Custom={};if(!Custom.UI)Custom.UI={};Custom.UI.TaskSelection=(function(){var userOptions={id:"rctsDD",css:"position: absolute;",options:["Implement Java code for task","Implement JS changes for task","Implement CSS changes for task","Implement XSL changes for task","Code Review (if needed) for task","JUnit Testing for task","Test Case Update for task","Test Case Review for task","Test Case Creation for task","Test Case Execution for task"]},targetId="name0";return{DropDown:(function(opts,s){s.addEventListener("keypress",function(e){if(e.keyCode==13)this.hide();},false);s.addEventListener("change",this.hide,false);for(var i=0,l=opts.options.length;i<l;i++){s.add(new Option(opts.options[i]),null);} with(s){id=opts.id;style.cssText=opts.css;style.display="none";size=1;} return document.body.appendChild(s);})(userOptions,document.createElement("select")),getTarget:function(){var el=(document.getElementById(targetId)||this.lkTarget);el.style.position="relative";return el;},getID:function(
@say2joe
say2joe / RWD-HD-IMG.js
Created October 5, 2012 17:16
Render Hi-Res IMGs for Retina Displays (JavaScript)
/**
* Retina image update script. Invoke with Retina.render().
* Retina.render() may be passed a selector for img selection.
* The default filter looks for imgs with data-scale="retina".
* @param {string|function} expr A CSS selector expression or jQuery filter function.
* @return {boolean|collection} Returns false or (for Retina displays) the images updated.
* @author Joe Johnson (joe.johnson@icrossing.com)
*/
(function(ns,$){
ns.Retina = {
@say2joe
say2joe / DOMCache.js
Last active April 12, 2021 03:49
DOM Cache for Application (JavaScript). Requires: jQuery and https://raw.github.com/say2joe/jquery.cache/master/jquery.cache.js
// Don't forget to include:
// https://raw.github.com/say2joe/jquery.cache/master/jquery.cache.js
var myApp = {
appInfo: {
description: "Caching paradigm for JavaScript Applications",
title: "jQuery App DOM Cache"
},
appProperty: (function(j){
return (j = jQuery.noConflict());
@say2joe
say2joe / grunt.js
Created October 5, 2012 18:22
Sample Grunt Task (JavaScript)
module.exports = function(grunt) {
grunt.initConfig({
min: {
plugins: {
src: ["vendor/jquery.isotope.min.js","vendor/plugins.js","vendor/modal.js","vendor/jqpp.js"],
dest: "dist/plugins.min.js",
separator: ';'
},
app: {
@say2joe
say2joe / slp.codes.js
Last active October 11, 2015 09:58
Sample JS App Template (JavaScript)
/**
* SLP.Modules.Codes extends the SLP.Modules object on DOM-ready.
* @module Codes
*/
SLP.Modules.Codes = {
/**
* First validate for empty fields, then check the campaign codes,
* making sure that they begin with T(masked), L(masked), or S(masked).
* @param {object} event jQuery Event object (form submit)
* @return {boolean} true if all validation passes.
@say2joe
say2joe / app.js
Last active October 11, 2015 18:27
JS App /w JSON Image Data
/**
* @namespace
* TCR (<masked>) is a global namespace object containing
* the methods and properties used throughout this application.
* @requires jQuery-1.8.2 and Portfolio.JS (and its dependencies).
*/
var TCR = {
Data: { Images: $() },
Images: { Slideshow: [], Gallery: [] },
initSlideshow: function(){
@say2joe
say2joe / r4a.js
Last active October 11, 2015 18:48
R4A: Utilizes messaging, modals, native error object, cookies, etc.
/**
* T*****: Racing For Awareness Contest and Sweepstakes.
* @author Joe Johnson (joe.johnson@icrossing.com)
* @requires jQuery
* @namespace
*/
var R4A = {
hasContestEnded: true,
Shirts: {}, places: [],
sweepstakes: "forms.html",
@say2joe
say2joe / printMethod.js
Created November 2, 2012 22:18
JS Printer (for DOM Node)
{
css: "path/to/cssForPrinting.css",
print: function(DOMobj){
var winPrinter = window.open('', "SLPPrinter", "width=900,height=525,top=150,left=150,toolbars=no,scrollbars=yes,status=no,resizable=yes"),
html = (DOMobj.jquery)? DOMobj.parent().html() : (DOMobj.parentNode)? DOMobj.parentNode.innerHTML : (DOMobj.innerHTML || '');
if (document.createStyleSheet) document.createStyleSheet(this.css); else // Dynamically added CSS is different for IE.
$("head",winPrinter.document).append($("<link/>").attr({ rel: "stylesheet", type: "text/css", href: this.css }));
$("body",winPrinter.document).append(html); winPrinter.focus(); winPrinter.print(); winPrinter.close();
return DOMobj;
}
@say2joe
say2joe / jQuery.fn.formData.js
Created November 30, 2012 00:13
jQuery extension for form GET requests requiring comma-separated values.
/**
* Extend jQuery with additional functionality to be used throughout app.
*/
$.fn.extend({
/** formData:
* Most form submissions will require special formatting different from
* a normal get request (a=val1,val2&b=val3 vs. a=val1&a=val2&b=val3).
* Sample use: $.getJSON(url,$("myFormElement").formData(),callback);.
* @return {String} Serialized form data appropriate for GET requests.
* @author Joe Johnson
@say2joe
say2joe / snipLoader.js
Last active February 25, 2021 06:06
Element loading message
// Sets the html of an element with "Loading ..." and continues to print a dot up to 20 times.
// If the element is ready to be updated with actual content, simply clearInterval($el[0].interval);
// Requires: jQuery v1.4+
$el.html(function(i,html){
this.intcount = 0;
this.interval = ($.proxy(function(el){
return setInterval(function(){
if (++el.intcount < 20) el.innerHTML += '.';
else clearInterval(el.interval);
}, 500);