Skip to content

Instantly share code, notes, and snippets.

function Api() {}
Api.prototype.fetchUsers = async function () {
const users = await getUsersFromApi();
return users;
};
Api.prototype.fetchProfileImg = async function (user) {
const profileImg = await getProfileImgFromUser(user);
return profileImg;
@MikeFielden
MikeFielden / entity_colors.md
Last active October 2, 2018 19:54
Entity colors and icons

EntityTypes colors

Material color palette — COSMIC

Cosmic Web Colors

EntityType primary accent icon
Artifacts #81c784 #81c784 #388E3C #388E3C fal fa-file-alt
Activities #4dd0e1 #4dd0e1 #0097a7 #0097a7 fal fa-stopwatch
Vehicles #FFD54F #FFD54F #FFA000 #FFA000 fal fa-rocket
@MikeFielden
MikeFielden / cy_example.js
Last active January 25, 2022 08:37
Cypress.io example spec
//
// **** Kitchen Sink Tests ****
//
// This app was developed to demonstrate
// how to write tests in Cypress utilizing
// all of the available commands
//
// Feel free to modify this spec in your
// own application as a jumping off point
@MikeFielden
MikeFielden / ParallelMiddlewares
Created August 28, 2015 12:51
Parallel middlewares
function parallel(middlewares) {
return function (req, res, next) {
async.each(middlewares, function (mw, cb) {
mw(req, res, cb);
}, next);
};
}
app.use(parallel([
getUser,
@MikeFielden
MikeFielden / merge.js
Created July 8, 2015 21:41
Array merge native
var array1 = [1, 2, 3];
var array2 = [4, 5, 6];
Array.prototype.push.apply(array1, array2);
console.log(array1); // is: [1, 2, 3, 4, 5, 6]
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
@MikeFielden
MikeFielden / index.js
Last active October 9, 2015 12:45
Enum-like structure in es2015
const shapeType = {
triangle: new Symbol()
};
// Demo func
function getArea(shape, options) {
var area = 0;
switch (shape) {
case shapeType.triangle:
@MikeFielden
MikeFielden / remove_all_docker_images.sh
Created June 2, 2015 01:15
Remove all Docker images
docker rmi $(docker images -q)
@MikeFielden
MikeFielden / stop_and_remove_all_containers.sh
Last active August 29, 2015 14:22
Stop and Remove all Docker containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
#Single line
docker rm -f $(docker ps -a -q)
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">