Skip to content

Instantly share code, notes, and snippets.

@matthewbeta
matthewbeta / scrim-gradient.scss
Last active January 22, 2024 15:52
A simple little SCSS mixin for creating scrim gradients
/*
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: (
@juanbrujo
juanbrujo / comunas-regiones.json
Last active April 19, 2024 21:12 — forked from sergiohidalgo/comunas-regiones-chile.json
Comunas y regiones de chile JSON
{
"regiones": [
{
"region": "Arica y Parinacota",
"comunas": ["Arica", "Camarones", "Putre", "General Lagos"]
},
{
"region": "Tarapacá",
"comunas": ["Iquique", "Alto Hospicio", "Pozo Almonte", "Camiña", "Colchane", "Huara", "Pica"]
},
@dweldon
dweldon / play-webpack.md
Created February 12, 2017 15:02
Add vue-play to a vue-cli webpack project

Introduction

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
@erikdubbelboer
erikdubbelboer / gscp
Last active January 12, 2018 05:12
Google Cloud shell wrappers
#!/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
@juanbrujo
juanbrujo / getElement.js
Created December 8, 2015 14:19
Shortcut to get elements
// 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
};
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

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.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 1, 2024 17:49
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@spiralx
spiralx / object-assign.js
Created July 6, 2015 17:31
Object.assign() browser polyfill
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');
}
@s2t2
s2t2 / jwplayer_notes.js
Last active April 12, 2019 07:20
Learning jwplayer behavior.
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)
@maarten00
maarten00 / pmt.js
Created March 19, 2015 09:56
Excel PMT in PHP and JavaScript
/**
* 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.