#JavaScript #deployment #observablehq

ObservableHQ notebooks for JavaScript demos and prototypes

ObservableHQ is a platform being built by Mike Bostock (creator of the D3 visualisation library), Jeremy Ashkenas (“Made CoffeeScript, Backbone.js, Underscore and other ragbag” from his Twitter bio) and Tom MacWright (creator of the big presentation framework, simple-statistics and documentation.js as well as D3 contributor amongst other things). Observable is not just another JavaScript sandbox. It introduces the notebook paradigm to JavaScript projects, those of you familiar with Jupyter notebooks, this is the equivalent with JavaScript instead of Python. ...

  • Hugo Di Francesco
    Author
5 min read
#deployment #Node #JavaScript #tooling

Deployment options: Netlify + Dokku on DigitalOcean vs now.sh, GitHub Pages, Heroku and AWS

Settling on a Netlify + Dokku on DigitalOcean deployment stack for JavaScript and Node. Over the last few years I’ve never quite settled on a goto deployment strategy for my apps and projects. Technology-wise it has settled towards Vue or static site generators for the frontend with Node on the backend, whether that’s for API servers or handling rendering through handlebars. What I’ve finally settled on is Netlify + Dokku on DigitalOcean. ...

  • Hugo Di Francesco
    Author
5 min read
#JavaScript #ES6 #interview #functional programming

Impress interviewers with recursion in JavaScript with ES6 features

There’s nothing as flashy and useful for JavaScript interviews than recursion. If you just want to be impressive with recursion in JavaScript, here are some semi real-world (technical test type) examples. The short definition of a recursive solution to a problem (in computer science) is: don’t use iteration. This usually means a function has to call itself with a smaller instance of the same problem until it hits a trivial case (usually defined in the problem). ...

  • Hugo Di Francesco
    Author
4 min read
#JavaScript #Sequelize #testing #Node

Unit Testing Sequelize 4 ES6 class models

In “Using ES6 classes for Sequelize 4 models” we explored how to define Sequelize models using ES6 classes. One of the benefits of such an approach is that it allows easy unit testing, it allows you to instantiate the model without the baggage of all of Sequelize (and/or a database). The examples will use Jest module auto-mocking but should be portable to other module mocking libraries (eg. Proxyquire) with some modifications. ...

  • Hugo Di Francesco
    Author
2 min read
#graphql #tooling #web development

A gentle introduction to GraphQL API integrations

GraphQL is a great alternative to REST (or other HTTP API designs). This is an quick introduction to the core concepts around consuming a GraphQL API. To see some examples consuming a GraphQL API: In Python, see Python GraphQL client requests example using gql In JavaScript (browser and Node), see last week’s Code with Hugo newsletter What is GraphQL and what problems does it solve? GraphQL is “a query language for your API”. ...

  • Hugo Di Francesco
    Author
5 min read
#JavaScript #Node #tooling #deployment

Build and deploy a Vue/React/Vanilla JS app with Parcel and GitHub pages

Parcel allows us to bundle frontend applications with no configuration and GitHub pages affords us a way to deploy them for free. Here’s how to use these two tools together to deploy a JavaScript application. Full example of a repo deployed like this: https://github.com/HugoDF/js-graphql-client-example, and see https://codewithhugo.com/js-graphql-client-example/. Or the repo with the demos: https://github.com/HugoDF/parcel-gh-pages-deploy and see https://codewithhugo.com/parcel-gh-pages-deploy/. ...

  • Hugo Di Francesco
    Author
2 min read
#git #bash #productivity

Change the date of a git commit

One of the greatest and worst things with git is that you can rewrite the history. Here’s a sneaky way of abusing that, I can’t think of a legitimate reason to do this. As with anything, thanks StackOverflow for all the options I can pick from 👍. Set the date of the last commit to the current date GIT_COMMITTER_DATE="$(date)" git commit --amend --no-edit --date "$(date)" Set the date of the last commit to an arbitrary date GIT_COMMITTER_DATE="Mon 20 Aug 2018 20:19:19 BST" git commit --amend --no-edit --date "Mon 20 Aug 2018 20:19:19 BST" ...

  • Hugo Di Francesco
    Author
1 min read