This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beforeEach(function() { | |
jasmine.addMatchers({ | |
// | |
// actual: data object to check for property | |
// | |
// expected: property or property chain as string | |
// | |
hasRequiredAttribute: function() { | |
return { | |
compare: function(actual, expected) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// for use of 100% CSS but still want that angular layer | |
// | |
// assumes standard ngAnimate CSS class usage `ng-EVENT` | |
// | |
// .animation-watcher { | |
// /* this transition tells ngAnimate to make the animation happen */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.directive( 'stopEvent', | |
[ function() { | |
'use strict'; | |
return { | |
restrict : 'A', | |
link : function(scope, element, attr) { | |
element.bind(attr.stopEvent, function(e) { | |
e.stopPropagation(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wait for document | |
document.body.className += " js-loading"; | |
window.addEventListener("load", removeLoadingClass, false); | |
function removeLoadingClass() { | |
document.body.className = document.body.className.replace("js-loading",""); | |
} | |
// wait for image | |
// Adjust the "querySelector" value to target your image | |
var img = document.querySelector("img"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Angular Base Apps | |
// by Base Apps | |
// https://github.com/base-apps/angular-base-apps | |
// Licensed under MIT Open Source | |
// updated by Travis Mullen | |
// | |
$include-css: () !default; | |
$modules: () !default; | |
$rem-base: 16px !default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// https://developers.google.com/web/fundamentals/getting-started/primers/promises | |
// | |
// With Promises | |
let dis = this | |
return new Promise(function (resolve, reject) { | |
return this.promises.reduce(function (chain, individualPromise) { | |
return chain.then(function () { | |
return individualPromise | |
}).then(function (value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a container from the mongo image, | |
# run is as a daemon (-d), expose the port 27017 (-p), | |
# set it to auto start (--restart) | |
# and with mongo authentication (--auth) | |
# Image used is https://hub.docker.com/_/mongo/ | |
docker pull mongo | |
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth | |
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception) | |
# add a root user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template lang="pug"> | |
router-link.button.large(:to='route') | |
| {{ message }} | |
.svg-icon.postfix.fill-white( | |
v-once='', | |
v-html='icon' | |
) | |
</template> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed | |
/* | |
By using the debounce function from lodash or another dedicated | |
utility library, we know the specific debounce implementation we | |
use will be best-in-class - and we can use it ANYWHERE. Not just | |
in our template. | |
*/ | |
new Vue({ | |
el: '#debounce-search-demo', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// truncate text | |
function trimMiddle (text, maxLength, div) { | |
const d = div || ' ' | |
const l = text.length | |
let t | |
let a | |
let b | |
if (l > maxLength) { | |
a = Math.floor((maxLength / 2) - 1) |