Skip to content

Instantly share code, notes, and snippets.

View davidemaser's full-sized avatar

David Maser davidemaser

View GitHub Profile
@davidemaser
davidemaser / organizr.html
Last active January 20, 2016 15:27
orGanizr plugin initiator
<script>
$(document).ready(function(){
$(this).organizr({
jsonData:'assets/ajax/bones.json',
jsFiles: false,
dataAsync:true
});
});
</script>
@davidemaser
davidemaser / organizr.json
Last active January 20, 2016 15:27
orGanizr JSON Structure
{"element":[
{
"tag":"section",
"id":"main",
"class":"",
"count":1,
"parent":"",
"parentMap":"",
"parentChild":0
},
@davidemaser
davidemaser / barebones_jq.html
Last active February 1, 2016 17:04
Just the most incredibly simple barebones html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
@davidemaser
davidemaser / ipad.js
Last active July 29, 2016 20:23
iPad Viewport fix
jQuery(window).bind('orientationchange', function() {
/* a */
var client = {
/*
Let's put all the client values in an object
to keep the code as readable as possible.
DOM manipulations by jQuery can cause errors
in values read from the browser. If we receive
inconsistent values for the client.width or
client.height objects, use vanilla javascript
@davidemaser
davidemaser / generator_JQ.js
Last active November 30, 2019 11:32
DOM element generator using JQUERY. Builds dom elements from JSON formatted parameters.
/**
* Created by David Maser.
*/
var generator = {
accept : ['button','div','section','ul','li','nav','form','radio','checkbox','footer','header'],
build:function(obj){
if(typeof obj == 'object') {
var _core = obj.core;
for (var i in _core) {
var _valid = $.inArray(_core[i].type,generator.accept);
@davidemaser
davidemaser / generator.js
Created December 6, 2016 22:23
DOM element generator in vanilla JavaScript. Builds dom elements from JSON formatted parameters.
/**
* Created by David Maser
*/
var generator = {
dom : document,
accept : ['button','div','section','ul','li','nav','form','radio','checkbox','footer','header'],
build:function(obj){
function testParentType(s){
if(s.indexOf('.')>-1){
return 'c'; // c for class
@davidemaser
davidemaser / shopifyCartQueue.js
Created April 17, 2017 19:10
Using the Shopify queue to add items to the cart
Shopify.queue = [];
Shopify.moveAlong = function() {
if (Shopify.queue.length) {
var request = Shopify.queue.shift();
Shopify.addItem(request.variantId, request.quantity, request.properties, Shopify.moveAlong);
}
else {
document.location.href = '/cart';
}
};