Skip to content

Instantly share code, notes, and snippets.

View ifyoumakeit's full-sized avatar
:octocat:
Githubbin’

Dave Garwacke ifyoumakeit

:octocat:
Githubbin’
View GitHub Profile
@ifyoumakeit
ifyoumakeit / Popup script
Last active August 29, 2015 14:00
Overlay Design
var createOverlay = function(row,button){
var o = $("<div></div>").addClass("overlayOuter").attr("id","overlay-"+row.replace(/\#/g,'').replace(/\,/g,'')).on('click',function(){o.hide();}).appendTo($("body"));
var i = $("<div></div>").addClass("overlayInner").on('click',function(e){e.stopPropagation();}).prepend($(row)).appendTo(o);
$("<div></div>").addClass("overlayClose").on('click',function(e){ o.hide(); $("body").removeClass("noScroll"); }).appendTo(i);
$(button).attr("href","#overlay").on('click',function(e){e.preventDefault();$("body").addClass("noScroll");o.show();});
}
@ifyoumakeit
ifyoumakeit / Facebook Invite Langauge Snippet.js
Created April 18, 2014 18:45
Fix for Facebook invite text and languages that have marks in text. Currently the platform converts it to HTML friendly versions.
NGX.App.config.sharing.inviteText = NGX.App.config.sharing.description;
@ifyoumakeit
ifyoumakeit / slider.js
Last active August 29, 2015 14:00
Hide Next button and save results on Quiz
$(function(){
$(".xFieldRadioChoice").click(function(){
$(this).siblings().removeClass("clicked");
$(this).addClass("clicked");
$(".xActionNext").removeClass("xDisabled");
});
$(".xFormPages").on( 'cycle-after', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
$(incomingSlideEl).find(".clicked").length==0 ? $(".xActionNext").addClass("xDisabled") : $(".xActionNext").removeClass("xDisabled");
@ifyoumakeit
ifyoumakeit / reorderWall.js
Last active August 29, 2015 14:01
Reorder Social Wall
// PASS OBJECT WITH SEARCH TERM & POSITION ( first, middle, last, or an integer )
// SEARCH TERMS are processed in the order they are added.
var searches = {
"fire" : "last",
"if" : "first",
"what" : "middle",
"why" : 2
};
reorderWall(searches);
@ifyoumakeit
ifyoumakeit / gzip.js
Created August 22, 2014 11:20 — forked from kig/gzip.js
TarGZ = function(){};
// Load and parse archive, calls onload after loading all files.
TarGZ.load = function(url, onload, onstream, onerror) {
var o = new TarGZ();
o.onload = onload;
o.onerror = onerror;
o.onstream = onstream;
o.load(url);
return o;
gistup
gistup
@ifyoumakeit
ifyoumakeit / getter.js
Created October 26, 2017 18:16
Getter Example
const order = {
subtotal: 35,
tax: 0.6,
get total() { return this.subtotal * this.tax }
}
order.subtotal // 35
order.tax // 0.6
order.total // 21
order.subtotal = 36
@ifyoumakeit
ifyoumakeit / compose.js
Created November 25, 2017 02:21
Transducers / Composing
/**
* Composes functions like c(f, g) === f(g(x)).
* @param {arguments} fns Multiple functions w/ map/reduce.
* @returns reducer seeded with identity function.
* @example compose(x => x + 2, x => x - 1)(5) // 6 (5 + 2 -1)
*/
const compose = (...fns) => {
return fns.reduce((acc, fn) => {
return (...args) => {
return acc(fn(...args));
@ifyoumakeit
ifyoumakeit / _struct.js
Last active January 4, 2018 17:57
Sortable Data Access Structure
/**
* Sort or set keys
* @param data {object} Keyed data store
* @param keysOrSort {array|function}
* @return {array}
*/
const sortKeys = (data, keysOrSort) => {
return typeof keysOrSort === "undefined"
? Object.keys(data).sort()
: typeof keysOrSort === "function"