TIL, 2018-04-02, More React: Getting state from JSON, Web Font loader.
Musings, Chef/Reliably Deploying Rails apps
- WTF DOES OHAI do?
- Fixing chef problems: update the thing.
berks update postgresql
berks vendor
: If you remove a cookbook, rerunning this doesn’t remove the stuff in theberks-cookbooks
.
Musings, React:
- Callback function for
setState
:this.setState({writingPrompts: writing_prompts}, this.sample);
create-react-app
has a JSON loader, so you can do this:import { writing_prompts } from '.././data.json';
to destructively importwriting_prompts
from the inside of whatever hash was indata.json
.- JSON loader doesn’t load files if it’s in array, make sure it has a key.
- This thing is cool:
let filteredArray = arr.filter(e => e!== randomElement);
, re: sampling out an element. At least now I’m able to do a filter functionally. I do think this is inefficient though, I can probably just do a slice somewhere. - Web Font loader.
- We use this, instead of adding a
link href
in theindex.html
, to speed up page rendering. The page will render, but wait for the components to get loaded.
- We use this, instead of adding a
$ npm install webfontloader --save
import WebFont from 'webfontloader';
WebFont.load({
google: {
families: ['Titillium Web:300,400,700', 'sans-serif']
}
});
- Web performance/render blocking CSS.
- Usually, rendering is blocked until CSS is available, because without CSS, the page will be relatively unusable. This leads to a “flash of unstyled content”.
- CSS’s media types and media queries allow us to address these use cases:
<link href="print.css" rel="stylesheet" media="print">
and<link href="other.css" rel="stylesheet" media="(min-width: 40em)">
- Make sure to keep your CSS lean, deliver it as quickly as possible, and use media types and queries to unblock rendering.
- Media types and media queries allow us to mark some CSS resources as non-render blocking.
- The browser downloads all CSS resources, regardless of blocking or non-blocking behavior.
- CSS things!
:root
- CSS variables and inheritance.
- Extracted Li
Musings, Back-end
- DNS Resolver performance explained
- CloudFlare was the fastest DNS for 72% of the locations.
- You can make multiple directories at the same time via
mkdir dir1 dir2
? tree
OMG I forgot about this.