git + dropbox = gitbox!

Let say you’d like to sync all your projects between different pcs you own. Surely you can put every project on GitHub but this is not good for closed source projects (not if you’re using their free plan).

You can put the entire project on DropBox, but it will fill your space with .obj, .dll, .tmp, /node_modules/, … stuff you really NOT need.

The trick is to keep just a bare repository into DropBox: a well formed gitignore file will prevent you to sync object files.
So I create a GitBox folder into my DropBox folder, then:

cd "c:\DropBox\GitBox"
mkdir MyAwesomeProject
cd MyAwesomeProject
git init --bare

cd "c:\MyDevPath\MyAwesomeProject"
git init
git remote add gitbox "c:\DropBox\GitBox\MyAwesomeProject"
git add *
git status
git commit -m "1st commit"
git push --set-upstream gitbox master

Leave a comment

Posted by on 2018/04/22 in dev


Tags: ,

Inspect a list of filenames (js)

This shortcut demonstrates the power of some ES6 features.

Given a list of filenames, a map function is applied onto the array to generate (another) array of objects. Arrow functions and parentheses (to return JSON objects) are the trick used to add properties “on the fly”.
The resulting object will have the name, path and stats information resolved.

Leave a comment

Posted by on 2018/04/20 in dev


Tags: , ,

SELECT latestversion FROM versionedRows: a comparative approach

Because there’s no “the best way to do things” but only the best way to do THIS thing (to read with Yoda voice).

Leave a comment

Posted by on 2017/09/07 in dev


Tags: , ,

GZip a file in memory (csharp)

It is a thing I ALWAYS forget: what’s the right piping sequence? How avoid errors? ..and so on…

Here’s the snippet

Leave a comment

Posted by on 2017/08/23 in dev


Tags: , ,

POST a file, read a JSON response

Here’s a trick to send a file to a server AND read a response from it, in the same context.
I used it with a Node.js server (Express + busboy) and it worked like a charm.

When using HTML forms, you can submit stuff to a server but you can’t read a response from it.
If you need some kind of “send data” → (do something server side) → “read response” it can be painful.

I wrote a workaround to manage this kind of situation. It is pretty simple:
– prepare a form as usual
– block the original event
– build an ajax request as a POST method

Here’s the code

Leave a comment

Posted by on 2017/07/14 in dev, Uncategorized


Tags: , ,

(another) handlebars template

I just started using loving gist.

This is a pretty basic Handlebars template, with its render engine.

Leave a comment

Posted by on 2017/06/12 in Uncategorized


Promises rejection (..but with style)

I find handy define this kind of function in my code:

function if_error(reject, err) {
  if (err) {

Now when I’ll need to handle a rejection, my code will be

something.can('go-wrong', (err) => {
  if_error(reject, err);

It’s something between pure functional programming and very readable code.

Leave a comment

Posted by on 2017/05/16 in dev


Tags: ,