Here are the steps I used to add vue-play to my vue-cli webpack project. These instructions assume a directory structure like this:
.
├── build
└── src
├── components
| /* | |
| A simple little SCSS mixin for creating scrim gradients | |
| Inspired by Andreas Larson - https://github.com/larsenwork | |
| https://css-tricks.com/easing-linear-gradients/ | |
| */ | |
| @mixin scrimGradient($startColor: $color-black, $direction: 'to bottom') { | |
| $scrimCoordinates: ( |
| { | |
| "regiones": [ | |
| { | |
| "region": "Arica y Parinacota", | |
| "comunas": ["Arica", "Camarones", "Putre", "General Lagos"] | |
| }, | |
| { | |
| "region": "Tarapacá", | |
| "comunas": ["Iquique", "Alto Hospicio", "Pozo Almonte", "Camiña", "Colchane", "Huara", "Pica"] | |
| }, |
Here are the steps I used to add vue-play to my vue-cli webpack project. These instructions assume a directory structure like this:
.
├── build
└── src
├── components
| #!/bin/bash | |
| # Copy files from and to Google Compute Engine instances | |
| # Automatically looks up the correct zone and uses ~/.ssh/id_rsa | |
| # Usage | |
| # gscp ./some.file some-instance-name:some-directory | |
| # gscp some-instance-name:some-directory ./some.file | |
| for project in $(gcloud projects list | grep -v PROJECT_ID | cut -d' ' -f 1); do | |
| PROJECT=$project |
| // Shortcut to get elements | |
| var $ = function(element) { | |
| if (element.charAt(0) === "#") { // If passed an ID... | |
| return document.querySelector(element); // ... returns single element | |
| } | |
| return document.querySelectorAll(element); // Otherwise, returns a nodelist | |
| }; |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent| if (!Object.assign) { | |
| Object.defineProperty(Object, 'assign', { | |
| enumerable: false, | |
| configurable: true, | |
| writable: true, | |
| value: function(target) { | |
| 'use strict'; | |
| if (target === undefined || target === null) { | |
| throw new TypeError('Cannot convert first argument to object'); | |
| } |
| jwplayer('player').setup({ ... }); | |
| // | |
| // Q: under which conditions does jwplayer return the duration of the current video? | |
| // | |
| console.log(jwplayer('player').getState(), jwplayer('player').getDuration()) | |
| "IDLE" -1 // fail | |
| jwplayer('player').play(true) |
| /** | |
| * Copy of Excel's PMT function. | |
| * Credit: http://stackoverflow.com/questions/2094967/excel-pmt-function-in-js | |
| * | |
| * @param rate_per_period The interest rate for the loan. | |
| * @param number_of_payments The total number of payments for the loan in months. | |
| * @param present_value The present value, or the total amount that a series of future payments is worth now; | |
| * Also known as the principal. | |
| * @param future_value The future value, or a cash balance you want to attain after the last payment is made. | |
| * If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0. |