Store files to GridFS in Meteor app


Recently I’ve started a new Meteor-based project which involves the ability for users to store their own images in the cloud. I’ve considered a number of options to provide this, from storing to local FS to Amazon S3. In the end I’ve decided that it would be convinient to store files in Mongo’s GridFS. I’d need a Mongo cluster anyway, so why not also store the files there.
But it turned out that there is no built-in support in Meteor for GridFS.

Read More

Quick tip: fish-shell PATH

Add path temporarily:

$ set -gx PATH $PATH <path>

Add path permanently:

$ touch ~/.config/fish/
$ echo "set -gx PATH \$PATH <path>" >> ~/.config/fish/

Adding something to PATH variable is a common task, it helps you to use short command names in the shell instead of full paths to executables.

The first code snippet uses fish’s builtin command set to add the <path> (replace it with a path to the executable) to the end of PATH array. Flags -g and -x mean, ‘global’ and ‘export’ (you can read about it in “man set”). This setting will be lost after you quit the current shell session, but it is good for testing.

The second snippet ensures that you have the fish’s config file, and adds the first command to the end of it. After that, the variable will be set every time you start the shell.

Useful git-commit hook

Here is a useful git usage tip.

Sometimes we all make changes in code that we don’t want to commit. For example:

// if (user.isAuthorised()) {
if (true) {

You may do this to test some things locally, but If you forget and push something like this to remote, bad things may happen.
There is a simple solution to this problem involving pre-commit hook. Specify some string tag to mark the changes you never-never want to commit, I use do-not-commit.

Read More