Skip to content

Instantly share code, notes, and snippets.

document.getElementById('someInputID').onkeypress = stopType;
$("#inputID").keypress(function(e){
if (tmrStopType!= undefined) clearTimeout(tmrStopType);
tmrStopType= setTimeout(function (){ stopTypeWork() }, 2000);
});
function stopTypeWork() {
// do work
}
@JDMcKinstry
JDMcKinstry / jqExtCursor.js
Created March 26, 2012 15:41
jQuery Ext: $.cursor();
(function($) {
if (!$.cursor) {
$.extend({
cursor: function(elm, command, args) {
if (elm) {
if (typeof elm === "string") {
if ($(elm).length <= 0) { // elm is command string
switch(elm.toLowerCase()) {
case "clear":
document.body.style.cursor = "default";
@JDMcKinstry
JDMcKinstry / $.jqCookie.js
Created April 11, 2012 17:53
Adds the simple ability to create and delete cookies using jQuery
(function($) { // TODO: Addin better error handling on try catch states and add encrypt security option
if (!$.jqCookie) {
$.extend({
jqCookie: function(getORset) {
var args = Array.prototype.slice.call(arguments).splice(1);
switch(typeof getORset) {
case "string":
switch(getORset) {
case 'get':
if (args.length === 0) {
@JDMcKinstry
JDMcKinstry / window.position.js
Created April 25, 2012 15:09
Simple code snippet to add a .position func to the window object
if (!window.position) {
window.position = function() {
return (navigator.appName.toLowerCase().indexOf("explorer") >= 0) ? { x: window.screenLeft, y: window.screenTop } : { x: window.screenX, y: window.screenY };
};
};
@JDMcKinstry
JDMcKinstry / gist:4111571
Created November 19, 2012 16:18
Sharepoint2010: How to reset InfoPath Signatures in a C# Workflow
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPFile formFile = workflowProperties.Item.File;
MemoryStream ms = new MemoryStream(formFile.OpenBinary());
XmlTextReader rdr = new XmlTextReader(ms);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(rdr);
rdr.Close();
ms.Close();
XmlNamespaceManager nsm = new XmlNamespaceManager(xmlDoc.NameTable);
if(typeof jQuery === 'undefined') {
// jQuery site src: https://code.jquery.com/jquery-1.9.1.min.js
var $script = document.createElement("script");
$script.src = "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js";
$script.type = "text/javascript";
document.getElementsByTagName('head')[0].appendChild($script);
}
;(function($) {
if (!$.aniAutoHeight) {
$.extend({
aniAutoHeight: function(elm, speed) {
if (!speed) speed = 200;
return elm.each(function(index){
var curHeight = $(this).height(),
autoHeight = $(this).css('height', 'auto').height();
$(this).height(curHeight).animate({height: autoHeight}, speed, function() { $(this).height('auto'); });
});
;(function($) {
if (!$.aniAutoHeight) {
$.extend({
aniAutoHeight: function(elm, speed) {
if (!speed) speed = 200;
return elm.each(function(index){
var curHeight = $(this).height(),
autoHeight = $(this).css('height', 'auto').height();
$(this).height(curHeight).animate({height: autoHeight}, speed, function() { $(this).height('auto'); });
});
@JDMcKinstry
JDMcKinstry / main.css
Last active December 18, 2015 07:19 — forked from bmegod/gist:5731771
/* ==========================================================================
Globals
========================================================================== */
@font-face {
font-family: 'GaramondPro';
src: url('fonts/AGaramondPro-Regular.otf');
font-weight: normal;
font-style: normal;
}