Skip to content

Instantly share code, notes, and snippets.

View keif's full-sized avatar

Keith Baker keif

View GitHub Profile
@keif
keif / Disclaimers.chunk
Created January 13, 2012 22:03 — forked from larscwallin/Disclaimer.chunk
Widgeteer IRXML
<h4> [[+Disclaimers.@attributes.PubDate]]:[[+Disclaimers.@attributes.PubTime]] </h4>
@keif
keif / README.txt
Created January 16, 2012 15:59 — forked from larscwallin/README.txt
SIMPLX Widgeteer 0.8.4
SIMPLX Widgeteer 0.8.4.kb
UPDATE 120116 10:59
Made a nested foreach loop to handle placeholders with the same parent reference.
UPDATE 120115 16:59
Changed so that the default chunkMatchingSelector is "", which is more likely to be the case.
@keif
keif / hasSupport for attribute
Created November 29, 2012 22:19
Detect Placeholder support for form elements
function hasSupport(elem, attribute) {
return attribute in elem;
}
$('body').delegate('textarea', 'focus input change keydown keyup', function(e) {
var $textArea = $(this);
if (!hasSupport($textArea[0], 'placeholder')) {
var placeholderText = $textArea.attr("placeholder");
if (this.value === $textArea.data("placeholder")) {
@keif
keif / placeholder.js
Created December 20, 2012 20:00
This mimics the HTML5 placeholder in browsers that don't support it. Requires jQuery - can be changed for earlier versions by converting the .on() event calls. The "blur" class was used to apply a lighter gray color to the text.
var placeholderSupport = ("placeholder" in document.createElement("input"));
var setPlaceHolderText = function(elem) {
var $textarea = $(elem);
var placeholderText = $textarea.attr("placeholder");
$textarea.data("placeholder", placeholderText);
if (placeholderText.length > 0) {
$textarea.val(placeholderText)
.addClass('blur');
}
@keif
keif / gitconfig
Last active December 24, 2015 10:19 — forked from kmorcinek/gitconfig
[core]
excludesfile = /Users/_user_/.gitignore_global
[fetch]
prune = true
[alias]
# log outputs
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --date=short
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --numstat
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate
# fancy log output
@keif
keif / omniture-debugger.js
Last active April 6, 2016 03:02
Code pasted in to a console to open the omniture debugger.
window.open("","stats_debugger","width=600,height=600,location=0,menubar=0,status=1,toolbar=0,resizable=1,scrollbars=1").document.write("<script language=\"JavaScript\" src=\"https://sitecatalyst.omniture.com/sc_tools/stats_debugger.html\"></"+"script>" + "<script language=\"JavaScript\">window.focus();</script>");
@keif
keif / gist:14e7cedbe0a98112ad30
Created April 1, 2015 05:06
Jekyll Command to include Drafts and Utilize dev config.
bundle exec jekyll serve --drafts --config _config.yml,_config_dev.yml --watch
@keif
keif / _config_dev.yml
Created April 1, 2015 05:10
A Dev YAML File example for Jekyll
title: Baker's GitHub Repo DEVELOPMENT
url: http://localhost:4000
baseurl: ""
@keif
keif / rotate
Created April 10, 2015 04:18
Problem: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
// Problem: Rotate an array of n elements to the right by k steps.
// For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
// How many different ways do you know to solve this problem?
var array = [1,2,3,4,5,6,7];
var result = [5,6,7,1,2,3,4];
// Solution 1 - Intermediate Array
function rotate(nums, k) {
var result = [],
@keif
keif / morse encode and decode
Last active August 29, 2015 14:19
A generic morse code encode/decode exercise.
var charCodes= {
"a": ". _",
"b": "_ . . .",
"c": "_ . _ .",
"d": "_ . .",
"e": ".",
"f": ". . _ .",
"g": "_ _ .",
"h": ". . . .",
"i": ". .",