Latest Posts

Welcome to DevLog

The open thought platform for developers.

Share your work as you work on it. Easier than a blog, handier than Twitter.

Sign in and write down valuable thoughts that would otherwise be forgotten.

Figuring out ecto's upsert behavior was a major pain. Take the following example:

|> User.changeset(attrs)
|> Repo.insert!(
  on_conflict: :replace_all,
  conflict_target: :github_id

Here, :replace_all tells ecto to update the existing record in the db with your data from the changeset (when a conflict occurs).

This is great. However, the unexpected part is that :replace_all also includes the id column in its updates. In other words, when a conflict occurs, ecto updates the existing record with a new incremental id. What??

I don't know when you'd want this. But to stop it, you need to explicitly tell ecto to exclude id:

  on_conflict: {:replace_all_except, [:id]},
  conflict_target: :steam_appid


My company is a SaaS but there's a lot of manual DB querying that we need to do on each customer environment. I want to automate that.


  • Tornado and various SQL sauce
  • Mithril and Construct-UI
  • Vanilla JS otherwise


Finished the unity tutorial finally!


still dont know how to do ssr with auth


Just wanted to share that I am currently writing up a blog post for this process as when I was searching for materials as to how to implement it, every tutorial I came across showed how to generate the QR code, and add it to Google authenticator, however none actually showed how to verify the code from the authenticator.

I will link it here if afterwards and hopefully it helps someone who is in the same situation that I found myself in :)


Been thinking about dask vs Husky vs Spark


Making sure proper error codes and messages are returned by the API.


A mate of mine is a writer by trade but around 2-3 years ago started mucking about with front-end web tech - HTML, CSS, Javascript. He's just about finished making his portfolio website and asked for a hand testing / reviewing from a technical angle and sorting out some finer points. It is such a joy seeing a consumately designed indie website. I'm looking at 4000 lines of hand-written CSS and it really takes me down memory lane.


A cli that randomly clicks around and messes with a website and reports what it is doing as a highly detailed tsv file.

Then you can see if any exceptions occur, read the reported tsv logs and decide if it warrants further investigation.


Some other functions you can call on your Map include:


map.has('cat'); //true

map.get('cat'); //tofu


map.has('dog'); //false


But let's say we do want to match all the case variations of funFunfun including FunFunFun, funfunfun etc...

Add the letter i to the end like so: /funFunfun/i

The letter i is one type of 'flag' that modifies regex search


Implemented an intricate anti-spam measure.

    var sf = 'sf_' + Math.random().toString(36).replace('0.', ''); 	    var sf = $('#sf');
    $('.donation-form').append($("<input type='hidden' name='sf'/>").val(sf));	
      sf.val(sf.val() + '!');
      sf.val(Math.random().toString(36).replace('0.', '') + $('#donation_form_id').val());
  }, 7000);	  }, 7000);
});	});