Skip to content

Instantly share code, notes, and snippets.

View PocketNinjaDesign's full-sized avatar

Duncan PocketNinjaDesign

View GitHub Profile
@PocketNinjaDesign
PocketNinjaDesign / jqlite.extension.findlite.js
Created February 19, 2018 20:14
jqlite most basic findLite method
// For when you just want a quick hack to find things using jqlite
// findVeryVeryLite :-P
/**
* @param {string} selector any 'element', '.class' or '#id'
* @returns {object} jqlite objects
* @description Finds 1 or many elements within a single element
*/
$.fn.findLite = function(selector) {
return $(this[0].querySelectorAll(selector));
@PocketNinjaDesign
PocketNinjaDesign / jqlite.extension.findFromAjax.js
Created February 19, 2018 20:34
jqlite most basic way of getting element from data retrieved with ajax
// NOTE: This also uses another function created called findLite
// https://gist.github.com/PocketNinjaDesign/b7808126e97f319929674d09e4ac85d1
/**
* @example
* // returns jqlite object using class
* $.fn.findFromAjax(response.data, '.some-class-name');
* @example
* // returns jqlite object using id
* $.fn.findFromAjax(response.data, '.someId');
@PocketNinjaDesign
PocketNinjaDesign / ios-double-tap-button-issue.scss
Last active August 22, 2018 21:42
The Annoying Mobile Double-Tap Link Issue IOS fix CSS
/*
The issue apparently according to
https://css-tricks.com/annoying-mobile-double-tap-link-issue/
is that having a hover causes safari ios to activate the hover first and
then the second click activates the link.
I came across this issue with a link that had a JS click on it but
had to double click. Thank you Mozilla for the solution
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover
*/
@PocketNinjaDesign
PocketNinjaDesign / es6.extend.object.js
Last active March 20, 2018 16:00
ES6 extend method replicating $.extend Passes ESlint checking too! Added immutable arrays line 32
//
// Code taken from http://youmightnotneedjquery.com/
// THEN, edited to es6 and altered to work with ESlint
//
// 1. extend objects the same as jQuery
// 2. passes eslint AirBnB
// 3. provides you with isTypeOf and isObject methods
// 4. Please remember to use Object.assign instead if object 1 deep
// You lucky people.
//