List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
/* ---- | |
css custom properties to manipulate color | |
MIT - 2017 - Soft Punch | |
https://gist.github.com/softpunch/ | |
set initial "main" color via HSL values. | |
automatically calculate harmonies and variations of that color with pure css. | |
harmonies are determined solely by hue. |
<template> | |
<div id="app"> | |
<p> | |
Pending: {{ $store.state.getInfoPending }} | |
</p> | |
<p> | |
{{ $store.state.getInfoData }} | |
</p> | |
</div> | |
</template> |
/* | |
Serve is a very simple static file server in go | |
Usage: | |
-p="8100": port to serve on | |
-d=".": the directory of static files to host | |
Navigating to http://localhost:8100 will display the index.html or directory | |
listing file. | |
*/ | |
package main |
//events - a super-basic Javascript (publish subscribe) pattern | |
var events = { | |
events: {}, | |
on: function (eventName, fn) { | |
this.events[eventName] = this.events[eventName] || []; | |
this.events[eventName].push(fn); | |
}, | |
off: function(eventName, fn) { | |
if (this.events[eventName]) { |
/** | |
* Think of this "main.js" file as your application bootstrap. | |
*/ | |
import Vue from 'vue' | |
import Resource from 'vue-resource' | |
import VueRouter from 'vue-router' | |
import routes from './routes' | |
import middleware from './middleware' |
/* need underscore.js */ | |
/** | |
* randomNum | |
* randomNum(3,6); => 4 | |
*/ | |
var randomNum = function(from, to) { | |
return from + Math.floor( Math.random() * (to - from + 1) ); | |
}; |
/* | |
* Based on: http://www.quirksmode.org/js/cookies.html | |
* and https://github.com/wojodesign/local-storage-js/blob/master/storage.js | |
* and https://gist.github.com/350433 | |
* License: http://www.opensource.org/licenses/MIT | |
*/ | |
(function(window) { | |
'use strict'; | |
window.sessionStorage = window.sessionStorage || { |
/* eventmodule */ | |
/* Events */ | |
var Events = { | |
on: function(events, callback) { | |
if(!this._observer) { | |
this._observer = $({}); | |
} | |
this._observer.bind(events, callback); |
var oldSafari = (function() { | |
var ua = window.navigator.userAgent; | |
if(!/safari/i.test(ua)) { | |
return false; | |
} | |
if(/chrome/i.test(ua)) { | |
// chrome has 'Safari' in its ua. | |
return false; | |
} | |
if(/mobile/i.test(ua)) { |