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
describe('GridController', function() { | |
beforeEach(module('GridApp')); | |
var GridApp, controller, scope, ctrl; | |
beforeEach(inject(function($rootScope, $controller) { | |
scope = $rootScope.$new(); | |
controller = $controller; | |
ctrl = controller('GridController', { |
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.module('myApp.filters', []) | |
/** | |
* Defines a filter on the $filter provider that will call a method | |
* to filter objects inside of ngRepeat. | |
* | |
* @return {Function} | |
* @param {Array} - the array to loop through | |
* @param {String} - the Object method name | |
* @param {Any} - the value to match against | |
* @return {Array} - the resultant array |
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
(function() { | |
angular.module('myApp.directives') | |
.directive('validateClass', [function() { | |
return { | |
restrict: 'A', | |
link: function validateClassLink(scope, element, attributes, ngForm) { | |
var fieldObj = ngForm[attributes.validateClass], | |
className = attributes.errorClass || 'has-error'; | |
scope.$watch(function() { |
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
function generateArray() { | |
'use strict'; | |
let length = Math.floor(Math.random() * 100000), | |
remove = Math.floor(Math.random() * length), | |
array = []; | |
for (let counter = 0; counter <= length; counter += 1) { | |
array.push(counter); | |
} |
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
const traceProperty = (object, property) => { | |
let value = object[property]; | |
Object.defineProperty(object, property, { | |
get () { | |
console.trace(`${property} requested`); | |
return value; | |
}, | |
set (newValue) { | |
console.trace(`setting ${property} to `, newValue); | |
value = newValue; |
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
function fetchResource(url, interval = 500, i = 1) { | |
let attempts = 0; | |
return new Promise((resolve, reject) => { | |
const repeat = setInterval(() => { | |
fetch(url) | |
.then(response => { | |
if (response.ok) { | |
resolve(response); | |
clearInterval(repeat); |
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
export const updatePath = (obj, path, value) => { | |
const paths = path.split('.'); | |
const location = paths.pop(); | |
let pointer = obj; | |
for (let point in paths) { | |
const path = paths[point]; | |
if (path in pointer) { | |
pointer = pointer[path]; | |
} else { |
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
/** | |
* This code was adapted from the excellent Braid Design System | |
* by SEEK OSS, you can find their original code code here | |
* https://github.com/seek-oss/braid-design-system/blob/master/lib/hooks/typography/basekick.ts | |
* | |
* They're doing some really amazing stuff and I got to copy them here, | |
* you should definitely check them out. | |
*/ | |
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
import sass from 'node-sass'; | |
import { resolve, extname } from 'path'; | |
import { processString } from 'uglifycss'; | |
import stringToTemplateLiteral from 'string-to-template-literal'; | |
import nodeSassImporter from 'node-sass-package-importer'; | |
const importer = nodeSassImporter(); | |
function transform(css) { | |
return `import { css } from 'lit-element'; |
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
import { LitElement } from 'https://cdn.pika.dev/lit-element@^2.3.1'; | |
/** @typedef {new (...args: any[]) => any} Constructor */ | |
/** | |
* @template {!Constructor} T | |
* @param {T} superclass - The class to extend | |
*/ | |
const FormControlMixin = (superclass) => | |
class FormControl extends superclass { |
OlderNewer