https://developers.google.com/web/tools/chrome-devtools/network/reference#filter http://alxndr.blog/2015/05/30/advanced-filtering-in-Chromes-Network-dev-tools.html
domain:localhost
// `MyComponent` depends on server-data, so it will render nothing | |
// or a fallback component until fetching is completed. | |
const withFallback = composeFallback(({ serverData }) => [serverData]); | |
export default withFallback(MyComponent); |
import React from "react"; | |
import { merge, compose } from "lodash/fp"; | |
export const castRouterParams = (keys, caster) => WrappedComponent => ({ | |
match, | |
...props | |
}) => { | |
const params = Object.fromEntries( | |
keys.map(key => { | |
const value = match.params[key]; |
node -v > .nvmrc
# Get the SHA of some branch. There must be a better way to do this. | |
git log -1 --pretty=oneline origin/somebranch | sed -E "s/^([^[:space:]]+).*/\1/" |
const download = (fileName, data) => { | |
const blob = new Blob([data]); | |
const url = window.URL.createObjectURL(blob); | |
const a = document.createElement("a"); | |
a.href = url; | |
a.download = fileName; | |
a.style = "display: none"; | |
document.body.appendChild(a); | |
a.click(); | |
a.remove(); |
// http://stackoverflow.com/a/23797348/1150427 | |
xhr.open('POST', url, true); | |
xhr.responseType = 'arraybuffer'; | |
xhr.onload = function () { | |
if (this.status === 200) { | |
var filename = ""; | |
var disposition = xhr.getResponseHeader('Content-Disposition'); | |
if (disposition && disposition.indexOf('attachment') !== -1) { | |
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/; |
let regex; | |
/* matching a specific string */ | |
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello" | |
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO" | |
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes... | |
/* wildcards */ | |
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo" | |
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo" |
An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.
Everything is broken up by tag, but within each the selectors aren't particularly ordered.
I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A
A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:
-webkit-appearance:none;
// https: //stackoverflow.com/a/3805213/4106263 | |
// https: //stackoverflow.com/questions/211383/what-methods-of-clearfix-can-i-use | |
// https: //github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css#L169 | |
.clearfix { | |
&::after, | |
&::before { | |
content: ' '; | |
/* 1 */ | |
display: table; |