Welcome to The Refactoring Tales, a book that documents some of the refactorings and changes I’ve made in recent (and mostly real-life) projects. This book isn’t going to teach you about language constructs, conditionals, functions, or so on, but hopefully offer insight into how to take steps to make your code more readable and more importantly, maintainable.
Jack Franklin
Examples of using apply function
Example 1: Append an array to another array.
|
|
Example 2: Get the max/min item in an array of numbers.
|
|
Grunt import external data
Grunt has two methods for importing external data:
- grunt.file.readJSON
- grunt.file.readYAML
For example, you can load data from a file into configuration of GruntFile:
|
|
Using Tempalte
to store external data into specific config properties, such as white
and green
in the above example. Then, you can get the data by method grunt.config.get()
.
Git pull with rebase and why
Users of Git are hopefully aware that a git pull does a git fetch
to pull down data from the specified remote, and then calls git merge
to join the changes received with your current branch’s work. However, that may not always be the best case. You can also rebase
the changes in, and that may end up being a lot cleaner. This can be done simply by tacking on the --rebase
option when you pull, like so:
|
|
Related Question:
List available grunt tasks of a project
In the project’s directory, run:
|
|