use git diff to generate file list
git diff --name-only master
add ext filter
const compareColor = (color, property) => (targetElement) => { | |
const tempElement = document.createElement('div'); | |
tempElement.style.color = color; | |
tempElement.style.display = 'none'; // make sure it doesn't actually render | |
document.body.appendChild(tempElement); // append so that `getComputedStyle` actually works | |
const tempColor = getComputedStyle(tempElement).color; | |
const targetColor = getComputedStyle(targetElement[0])[property]; | |
document.body.removeChild(tempElement); // remove it because we're done with it |
import { Ref, reactive, onMounted, watch, toRefs } from '@vue/composition-api' | |
// const { data, error } = useSWR('/api/user', fetcher) | |
export type fetcherFn<Data> = (...args: any) => Data | Promise<Data> | |
function isDocumentVisible (): boolean { | |
if ( | |
typeof document !== 'undefined' && | |
typeof document.visibilityState !== 'undefined' | |
) { |
use git diff to generate file list
git diff --name-only master
add ext filter
"use strict"; | |
// Generate webpack config with CLI service | |
const webpackConfig = require("@vue/cli-service/webpack.config.js"); | |
// Create express app | |
const express = require("express"); | |
const app = express(); | |
// Configure webpack as middleware |
#!/bin/bash | |
# Launch inside a create-react-app project after building the production build. | |
# Require `jq`. | |
diff \ | |
<(find src -type f \( -name '*.js' -o -name '*.jsx' -o -name '*.css' \) | sort) \ | |
<(cat build/**/*.map | jq --raw-output '.sources | join("\n")' \ | |
| grep -v '\.\./' | grep -E '\.(js|jsx|css)$' \ | |
| sed "s#^#src/#" | sort | uniq) \ |
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that | |
// does not support `nomodule` is probably not being used anywhere. The code below is left | |
// for posterity. | |
/** | |
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will | |
* load <script nomodule> anyway. This snippet solve this problem, but only for script | |
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script> | |
* | |
* Again: this will **not** prevent inline script, e.g.: |
# set the base image to Debian | |
# https://hub.docker.com/_/debian/ | |
FROM debian:latest | |
# replace shell with bash so we can source files | |
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | |
# update the repository sources list | |
# and install dependencies | |
RUN apt-get update \ |
/** | |
* Used for inter-object communication. | |
* (Semi-)drop in replacement for Rik Schennink's Observer. | |
* | |
* Implementation differences: | |
* - ES6 | |
* - The use of WeakMaps | |
* - inform() and conceal() don't return a boolean indicating success. | |
* - Subscription fn's are called with seperate arguments, instead of one data parameter. This is backwards compatible. | |
* |
'use strict'; | |
const fs = require('fs'); | |
const glob = require('glob').sync; | |
const mkdirp = require('mkdirp').sync; | |
const sass = require('node-sass'); | |
const path = require('path'); | |
const streams = require('stream'); | |
const runner = {}; |