| var groupBy = function(data, key) { // `data` is an array of objects, `key` is the key (or property accessor) to group by | |
| // reduce runs this anonymous function on each element of `data` (the `item` parameter, | |
| // returning the `storage` parameter at the end | |
| return data.reduce(function(storage, item) { | |
| // get the first instance of the key by which we're grouping | |
| var group = item[key]; | |
| // set `storage` for this instance of group to the outer scope (if not empty) or initialize it | |
| storage[group] = storage[group] || []; | |
| curl https://raw.githubusercontent.com/cleanbrowsing/dnsperftest/master/dnstest.sh | bash | sort -k 22 -n |
- Install prettier
- Make a .prettierignore file, and add directories you'd like prettier to not format, for example:
**/node_modules - Run
prettier --write "**/*.js"*Don't forget the quotes. - Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
- Update
package.json, setversionto a prerelease version, e.g.2.0.0-rc1,3.1.5-rc4, ... - Run
npm packto create package - Run
npm publish <package>.tgz --tag nextto publish the package under thenexttag - Run
npm install --save package@nextto install prerelease package
I've been using create-react-app lately as I find it very useful to kick things off while starting a project. I almost always follow JavaScript Standard Style and I found myself googling it so I figured out I should write it down.
I really like keeping dependencies as local as possible but if you prefer you can install it globally.
yarn add standard --devor
So, with credit to the Factorio wiki and cbednarski's helpful gist, I managed to eventually setup a Factorio headless server. Although, I thought the process could be nailed down/simplified to be a bit more 'tutorialised' and also to document how I got it all working for my future records.
The specific distro/version I'm using for this guide being Ubuntu Server 16.04.1 LTS. Although, that shouldn't matter, as long as your distro supports systemd (just for this guide, not a Factorio headless requirement, although most distros use it as standard now).
The version of Factorio I shall be using is 0.14.20, although should work for any version of Factorio 0.14.12 and higher.
Just a note to newcomers: If there are any issues with the installation steps, people in the comments are doing a good job
| -- Create a group | |
| CREATE ROLE readaccess; | |
| -- Grant access to existing tables | |
| GRANT USAGE ON SCHEMA public TO readaccess; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
| -- Grant access to future tables | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |