Skip to content

Instantly share code, notes, and snippets.

View red2678's full-sized avatar
🏠
Working from home

Anthony Trimble red2678

🏠
Working from home
View GitHub Profile
@red2678
red2678 / gist:228994be0e140f1ab2c7e322d5ff74ab
Created July 29, 2016 04:48 — forked from yesvods/gist:51af798dd1e7058625f4
Merge Arrays in one with ES6 Array spread
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
@red2678
red2678 / .eslintrc
Created July 27, 2015 03:02
ESLINT Reset
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
"objectLiteralDuplicateProperties": false, // enable duplicate object literal properties in strict mode
@red2678
red2678 / css.mkd
Last active August 29, 2015 14:23
CSS REMS Example
@red2678
red2678 / tap.js
Last active August 29, 2015 14:07
Mobile Tap Event
// From Here: http://www.gianlucaguarini.com/blog/detecting-the-tap-event-on-a-mobile-touch-device-using-javascript/
var getPointerEvent = function(event) {
return event.originalEvent.targetTouches ? event.originalEvent.targetTouches[0] : event;
};
var $touchArea = $('#touchArea'),
touchStarted = false, // detect if a touch event is sarted
currX = 0,
currY = 0,
cachedX = 0,
@red2678
red2678 / HandlebarsHelperIf.js
Last active August 29, 2015 14:07
Handlebars Helper If
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
console.log(v1)
switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '===':
return (v1 === v2) ? options.fn(this) : options.inverse(this);
case '<':
return (v1 < v2) ? options.fn(this) : options.inverse(this);
case '<=':
@red2678
red2678 / clearfix.css
Last active March 20, 2017 15:34
ClearFix
/**
* http://nicolasgallagher.com/micro-clearfix-hack/
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
@red2678
red2678 / font_face.scss
Last active August 29, 2015 14:07
Font Face Example
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff') format('woff'), /* Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
/*Read More Here:
@red2678
red2678 / Pseudo-Classes
Created September 30, 2014 00:00
CSS Pseudo-Classes
Info here: https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
and here: http://www.w3schools.com/cssref/css_selectors.asp
---
:active
:checked
:default
:dir()
:disabled
:empty
:enabled
@red2678
red2678 / JSONP_Example.js
Last active August 29, 2015 14:07
JSONP Example
// Firstly you need access to the JSON file to wrap it in a “callback function”.
//In this case I have called it “jsonCallback”. This will be the function called by the AJAX request.
jsonCallback(
{
"sites":
[
{
"siteName": "JQUERY4U",
"domainName": "http://www.jquery4u.com",
"description": "#1 jQuery Blog for your Daily News, Plugins, Tuts/Tips &amp; Code Snippets."
@red2678
red2678 / 50_us_state_list.txt
Last active August 29, 2015 14:02
50 US State Select List
AL|Alabama
AK|Alaska
AZ|Arizona
AR|Arkansas
AS|American Samoa
CA|California
CO|Colorado
CT|Connecticut
DE|Delaware
DC|District of Columbia