Skip to content

Instantly share code, notes, and snippets.

Avatar
😷

Tim Phillips tim-phillips

😷
  • Los Angeles
View GitHub Profile
@robmathers
robmathers / groupBy.js
Created Oct 25, 2018
A more readable and annotated version of the Javascript groupBy from Ceasar Bautista (https://stackoverflow.com/a/34890276/1376063)
View groupBy.js
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] || [];
@tracker1
tracker1 / detect-fastest-dns.sh
Last active Apr 6, 2018
Linux Troubleshooting
View detect-fastest-dns.sh
curl https://raw.githubusercontent.com/cleanbrowsing/dnsperftest/master/dnstest.sh | bash | sort -k 22 -n
@Mohamed3on
Mohamed3on / batchPrettier.md
Last active Jul 1, 2020
Run prettier on all JS files in a directory
View batchPrettier.md
  1. Install prettier
  2. Make a .prettierignore file, and add directories you'd like prettier to not format, for example: **/node_modules
  3. Run prettier --write "**/*.js" *Don't forget the quotes.
  4. Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
View semantic-commit-messages.md

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@schmich
schmich / npm-prerelease.md
Last active Sep 3, 2020
Publish a prerelease package to NPM
View npm-prerelease.md
  • Update package.json, set version to a prerelease version, e.g. 2.0.0-rc1, 3.1.5-rc4, ...
  • Run npm pack to create package
  • Run npm publish <package>.tgz --tag next to publish the package under the next tag
  • Run npm install --save package@next to install prerelease package
@dreamorosi
dreamorosi / standardJS-in-CRA.md
Last active Aug 18, 2020
Add Standard JS to create-react-app project
View standardJS-in-CRA.md

Standard JS in create-react-app

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.

Get Standard JS

I really like keeping dependencies as local as possible but if you prefer you can install it globally.

yarn add standard --dev

or

@philss
philss / ternjs-with-neovim.md
Last active Aug 12, 2018
Some details about my installation of Ternjs with Neovim and Deoplete
View ternjs-with-neovim.md

Ternjs with Neovim

  • upgrade nvim (in my case, I have the master version):
$ brew tap neovim/neovim
$ brew reinstall --HEAD neovim
  • check Python 2 and 3, if are installed:
$ which python2
@othyn
othyn / factorio_headless_guide.md
Last active Sep 9, 2020
How to setup a Factorio Headless Server
View factorio_headless_guide.md

[LINUX] Factorio Headless Server Guide

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.

Alternate

If you prefer a simple, automated setup, [Bisa has a really handy init script that will do most of the work for

@oinopion
oinopion / read-access.sql
Created Oct 5, 2016
How to create read only user in PostgreSQL
View read-access.sql
-- 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;
You can’t perform that action at this time.