Skip to content

Instantly share code, notes, and snippets.

View abrahamjuliot's full-sized avatar
Focusing

Abraham abrahamjuliot

Focusing
View GitHub Profile
@abrahamjuliot
abrahamjuliot / dabblet.css
Created July 29, 2014 19:15
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@abrahamjuliot
abrahamjuliot / dom.ts
Last active December 8, 2016 05:46
A very minimal dom manip library
// by Abraham Juliot, December 2016
/* SELECTORS
* myElement = dom('top', 'id') or dom('#red', 'id') uses getElementById, returns an Element object
* myElement = dom('.note a', 'first') uses querySelector, returns an Element object
* myElements = dom('red', 'class') or dom('.red', 'class') uses getElementsByClassName, returns a HTMLCollection object
* myElements = dom('span', 'tag') uses getElementsByTagName, returns a HTMLCollection object
* myElements = dom('article img') uses querySelectorAll, returns a NodeList object
*
* RETURN METHODS
@abrahamjuliot
abrahamjuliot / filterBy.js
Last active February 25, 2017 02:36
filter function for js arrays and or array of objects
// filterBy(deepArrayOfAnything, "friend", {limitTo: 2, sortBy: "name", ignoreKey: "keywords"})
(function (win, doc, undefined) {
const isTypeArray = (obj) => Array.isArray(obj),
isTypeObject = (obj) => (typeof obj === 'object'),
isObjectOrArray = (obj) => (isTypeObject(obj) || isTypeArray(obj)),
isObjectAndNotArray = (obj) => (isTypeObject(obj) && !isTypeArray(obj)),
isNumeric = (num) => !isNaN(num),
isNumberBooleanOrString = (obj) => (
typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean'),
@abrahamjuliot
abrahamjuliot / flickity-sample.html
Last active January 25, 2017 17:53
This is an html sample using flickityJS
<style>
@import url("http://npmcdn.com/flickity@2/dist/flickity.css");
.carousel * {
box-sizing: border-box;
}
.carousel img {
height: auto;
}
.carousel {
background: #FAFAFA;
@abrahamjuliot
abrahamjuliot / expire.js
Last active April 20, 2017 20:54
expire.js
(function() {
// example: <li data-expire="April 17, 2017"></li>
var $elems = document.querySelectorAll('[data-expire]'),
today = new Date();
for(
var el = 0,
len = $elems.length,
expire = null;
el < len;
@abrahamjuliot
abrahamjuliot / blockify.js
Last active July 8, 2017 17:47
blocks mp3 Ads on spotify web player (2017)
(function() {
// VARIABLES
const
// dom terms
dom = document,
query = 'querySelector',
parent = 'parentNode',
next = 'nextElementSibling',
attr = 'getAttribute',
@abrahamjuliot
abrahamjuliot / PageTransition.js
Last active July 21, 2017 14:54
page fade out transition
// Page Transition
(function () {
"use strict";
var
doc = document,
$content = doc.querySelector('#content'),
$main = doc.querySelector('#main'),
$footer = doc.querySelector('.prefooter'),
$links = doc.querySelectorAll('#content a[href^="/"]'),
@abrahamjuliot
abrahamjuliot / xhr.js
Last active September 4, 2017 16:15
mini xhr library
// factory
const http = () => {
const
XHR = () => {
return new XMLHttpRequest()
},
onload = (req, fn, parse = true) => {
req.onload = () => {
if (req.status >= 200 && req.status < 400) {
let data = req.responseText
@abrahamjuliot
abrahamjuliot / grad-template.pug
Created September 10, 2017 21:25
Pug Template for Grad Student Profiles
//--------------Variables-------------
-
first= "",
last= "",
profFirst= "",
profLast= "",
program= "PhD, Environmental Toxicology",
eduList= [
""
],
@abrahamjuliot
abrahamjuliot / faculty-template.pug
Last active September 11, 2017 21:31
Pug/Mustache Faculty Template
//--------------Variables-------------
-
first = '',
last = '',
position = '',
office = '',
phone = '',
websiteURL = '',
invite = '',
degrees = [