#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
#cdn #dev-decoded #productivity

The step-by-step guide to create a domain redirect with Cloudflare

Be logged into your dashboard. Select the domain you want to redirect from Go to page rules Click “Create page rule” Enter your.domain/* (matches all traffic) for which URLs will have their traffic redirected Click “Add a Setting” Select “Forwarding URL” Select the type of redirect, I recommend 302s since they’re less aggressively cached (so if you ever want to use that domain to do something else other than redirect, you can) Enter your forwarding URL Click “Save and Deploy” You’re done, you’ve just created a redirect from your domain to another one 🙂 ...

  • Hugo Di Francesco
    Author
1 min read
#git #web development #productivity

Split an existing git commit

One of git’s main differences when compared to other version control systems is that it lets the user rewrite the history. The main way to do this is to use git rebase, usually followed by a git push --force to overwrite history the remote with the local history. Here’s a look at how to split existing commits using rebase, reset and commit. Say you have two files edited in a commit (A and B) and you would like to get the changes from one of those files (A) into your current branch but not those from the other (B). ...

  • Hugo Di Francesco
    Author
2 min read
#JavaScript #Sequelize #Node #productivity

Using ES6 classes for Sequelize 4 models

The ES2015 or ES6 specification introduced class to JavaScript. Libraries like React went from React.createClass to class MyComponent extends React.Component, ie went from rolling their own constructor to leveraging a language built-in to convey the programmer’s intent. For a Node.js web application’s persistence layer, a few databases come to mind like MongoDB (possibly paired with mongoose), or a key-value store like Redis. To run a relational database with a Node application, Sequelize, “An easy-to-use multi SQL dialect ORM for Node. ...

  • Hugo Di Francesco
    Author
4 min read
#dev-decoded #git #programming #Productivity

Learn git even if you don’t code

The tools we wield define us, git is the one tool all developers use Git is a ubiquitous version control tool. The way it works tightly correlates with software engineering and the mindsets of developers. It was purpose-built and designed to be used for the development of the Linux Kernel, one of the largest software projects that’s depended on by millions of developers. Your editing workflow is painful because it’s not version-controlled As part of a team, your editing workflow probably consists of sending a file back and forth for review, comment and amendments. ...

  • Hugo Di Francesco
    Author
3 min read
#dev-decoded #Web development #Productivity

In simple terms: code on the backend, frontend and how they interact

A look at the shifting boundaries of the web development stack This was originally posted as an answer on Quora: How do frontend code and backend code interact with each other? Let’s start with quick definitions: Frontend All things the browser can read, display and/or run. This means HTML, CSS and JavaScript. HTML (Hypertext Markup Language) tells the browser “what” content is, eg. “heading”, “paragraph”, “list”, “list item”. CSS (Cascading Style Sheets) tells the browser how to display elements eg. ...

  • Hugo Di Francesco
    Author
5 min read
#Testing #JavaScript #Productivity

AVA, low-config testing for JavaScript

A JavaScript testing library for 2017 AVA is a Futuristic JavaScript test runner. Some of its best features are: it works out of the box, no need to specify a blob for test files or add Babel hooks it’s runs tests in parallel, this stops you from using global state and runs faster the tests are async by default I quite like AVA since I can just drop it in and reap benefits without too much hassle. ...

  • Hugo Di Francesco
    Author
4 min read
#JavaScript #Functional Programming #Productivity

First-class and Higher Order Functions: Effective Functional JavaScript

Functions: the killer JavaScript feature we never talk about. JavaScript is a very in-demand language today. It runs in a lot of places from the browser to embedded systems and it brings a non-blocking I/O model that is faster than others for some types of applications. What really sets JavaScript apart from the rest of scripting languages is its highly functional nature. JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java. ...

  • Hugo Di Francesco
    Author
8 min read
#JavaScript #Functional Programming #Productivity

Closures, Partial Application and Currying: Effective Functional JavaScript

Spices and other ingredients of a great curry To use JavaScript to its full potential you have to embrace its strong functional programming base. We’re going to explore some crucial and powerful functional constructs: closures, partial application and currying that make JavaScript terse yet understandable. The basics Functional programming is a programming paradigm that follows a more mathematical computation model. Let’s go through some basics to make your JavaScript more functional. ...

  • Hugo Di Francesco
    Author
7 min read