From de0838743acf02849b8dbaf340e4fa41ec8022f1 Mon Sep 17 00:00:00 2001 From: Zeno Popovici Date: Sun, 21 Aug 2016 14:31:30 +0300 Subject: [PATCH 1/5] Tip #0 --- .../javascript/2015-12-29-insert-item-inside-an-array.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/_posts/en/javascript/2015-12-29-insert-item-inside-an-array.md b/_posts/en/javascript/2015-12-29-insert-item-inside-an-array.md index f85fd184..0784df05 100644 --- a/_posts/en/javascript/2015-12-29-insert-item-inside-an-array.md +++ b/_posts/en/javascript/2015-12-29-insert-item-inside-an-array.md @@ -184,4 +184,9 @@ var items = ['one', 'two', 'three', 'four']; items.splice(items.length / 2, 0, 'hello'); ``` -I tried to run these tests in various Browsers and OS and the results were similar. I hope these tips will be useful for you and encourage to perform your own tests! \ No newline at end of file +I tried to run these tests in various Browsers and OS and the results were similar. I hope these tips will be useful for you and encourage to perform your own tests! + +## Playground +
+ JS Bin on jsbin.com +
From 5342767e552b19aaf8584fc9eb7710c969d55b74 Mon Sep 17 00:00:00 2001 From: Zeno Popovici Date: Sun, 21 Aug 2016 15:07:14 +0300 Subject: [PATCH 2/5] #1 --- .../en/angular/2016-01-01-angularjs-digest-vs-apply.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/_posts/en/angular/2016-01-01-angularjs-digest-vs-apply.md b/_posts/en/angular/2016-01-01-angularjs-digest-vs-apply.md index 79e9e72a..64e9d1f2 100644 --- a/_posts/en/angular/2016-01-01-angularjs-digest-vs-apply.md +++ b/_posts/en/angular/2016-01-01-angularjs-digest-vs-apply.md @@ -3,7 +3,7 @@ layout: post title: AngularJs - `$digest` vs `$apply` tip-number: 01 -tip-username: loverajoel +tip-username: loverajoel tip-username-profile: https://github.com/loverajoel tip-tldr: JavaScript modules and build steps are getting more numerous and complicated, but what about boilerplate in new frameworks? tip-writer-support: https://www.coinbase.com/loverajoel @@ -40,4 +40,9 @@ $scope.$apply(() => { - If you only need to update the current scope or its children, use `$digest`, and prevent a new digest cycle for the whole application. The performance benefit is self-evident. - `$apply()` is a hard process for the machine and can lead to performance issues when there is a lot of binding. -- If you are using >AngularJS 1.2.X, use `$evalAsync`, which is a core method that will evaluate the expression during the current cycle or the next. This can improve your application's performance \ No newline at end of file +- If you are using >AngularJS 1.2.X, use `$evalAsync`, which is a core method that will evaluate the expression during the current cycle or the next. This can improve your application's performance. + +## Playground +
+ Not available due to the nature of the tip. +
From f11cf38e0c4e884d73338040bb0fdd6cdb48f4f0 Mon Sep 17 00:00:00 2001 From: Zeno Popovici Date: Sun, 21 Aug 2016 15:07:24 +0300 Subject: [PATCH 3/5] #2 --- ...16-01-02-keys-in-children-components-are-important.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/_posts/en/react/2016-01-02-keys-in-children-components-are-important.md b/_posts/en/react/2016-01-02-keys-in-children-components-are-important.md index 7671c5cb..8d33c46b 100644 --- a/_posts/en/react/2016-01-02-keys-in-children-components-are-important.md +++ b/_posts/en/react/2016-01-02-keys-in-children-components-are-important.md @@ -3,7 +3,7 @@ layout: post title: Keys in children components are important tip-number: 02 -tip-username: loverajoel +tip-username: loverajoel tip-username-profile: https://github.com/loverajoel tip-tldr: The key is an attribute that you must pass to all components created dynamically from an array. It's a unique and constant id that React uses to identify each component in the DOM and to know whether it's a different component or the same one. Using keys ensures that the child component is preserved and not recreated and prevents weird things from happening. tip-writer-support: https://www.coinbase.com/loverajoel @@ -44,4 +44,9 @@ render() { - You can create your own unique id. Be sure that the method is fast and attach it to your object. - When the number of children is large or contains expensive components, use keys to improve performance. -- [You must provide the key attribute for all children of ReactCSSTransitionGroup.](http://docs.reactjs-china.com/react/docs/animation.html) \ No newline at end of file +- [You must provide the key attribute for all children of ReactCSSTransitionGroup.](http://docs.reactjs-china.com/react/docs/animation.html) + +## Playground +
+ Not available due to the nature of the tip. +
From 9d72906a7bf5462cc10a6c097a00879b5f862d8b Mon Sep 17 00:00:00 2001 From: Zeno Popovici Date: Sun, 21 Aug 2016 15:07:32 +0300 Subject: [PATCH 4/5] #3 --- .../en/javascript/2016-01-03-improve-nested-conditionals.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_posts/en/javascript/2016-01-03-improve-nested-conditionals.md b/_posts/en/javascript/2016-01-03-improve-nested-conditionals.md index 305b107c..37e75d1f 100644 --- a/_posts/en/javascript/2016-01-03-improve-nested-conditionals.md +++ b/_posts/en/javascript/2016-01-03-improve-nested-conditionals.md @@ -3,7 +3,7 @@ layout: post title: Improve Nested Conditionals tip-number: 03 -tip-username: AlbertoFuente +tip-username: AlbertoFuente tip-username-profile: https://github.com/AlbertoFuente tip-tldr: How can we improve and make a more efficient nested `if` statement in javascript? @@ -104,3 +104,6 @@ if (color in colorObj) { ``` Here you can find more information about [this](http://www.nicoespeon.com/en/2015/01/oop-revisited-switch-in-js/). + +## Playground +JS Bin on jsbin.com From bdaaa5c58bc4c7009b321d8b97ae28a23e078f9d Mon Sep 17 00:00:00 2001 From: Zeno Popovici Date: Sun, 21 Aug 2016 15:21:24 +0300 Subject: [PATCH 5/5] #4 --- ...016-01-04-sorting-strings-with-accented-characters.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/_posts/en/javascript/2016-01-04-sorting-strings-with-accented-characters.md b/_posts/en/javascript/2016-01-04-sorting-strings-with-accented-characters.md index 9331f29d..6782346b 100644 --- a/_posts/en/javascript/2016-01-04-sorting-strings-with-accented-characters.md +++ b/_posts/en/javascript/2016-01-04-sorting-strings-with-accented-characters.md @@ -3,7 +3,7 @@ layout: post title: Sorting strings with accented characters tip-number: 04 -tip-username: loverajoel +tip-username: loverajoel tip-username-profile: https://github.com/loverajoel tip-tldr: Javascript has a native method **sort** that allows sorting arrays. Doing a simple `array.sort()` will treat each array entry as a string and sort it alphabetically. But when you try order an array of non ASCII characters you will obtain a strange result. tip-writer-support: https://www.coinbase.com/loverajoel @@ -68,4 +68,9 @@ Fortunately, there are two ways to overcome this behavior [localeCompare](https: - For each method you can customize the location. - According to [Firefox](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#Performance) Intl.Collator is faster when comparing large numbers of strings. -So when you are working with arrays of strings in a language other than English, remember to use this method to avoid unexpected sorting. \ No newline at end of file +So when you are working with arrays of strings in a language other than English, remember to use this method to avoid unexpected sorting. + +## Playground +