teleren/devto huggingface dataset:
Use of IIFE to Create a Module
Tags: oop, javascript, newbie
Published: 2019-04-05 17:08:14

---
title: Use of IIFE to Create a Module 
published: true
description: How we can use IIFE(Immediately Invoked functional Expression) to create module.
tags: oop, javascript, newbie
---

An immediately invoked function expression (IIFE) is often used to group related functionality into a single object or module. For example, let's consider we need to wrap this two mixins in a module.

<pre>
<code>
function glideMixin(obj){
    obj.glide = function(){
        console.log("Gliding on the water");
    };    
}

function flyMixin(obj){
    obj.fly = function(){
        console.log("Flying Woohoo");
    };
}
</code>
</pre>
we can group this two mixin in a module using IIFE. See below how can we do that.

<pre>
<code>
let motionModule = (function(){
    return {
        glideMixin: function(obj){
            obj.glide = function(){
                console.log("Gliding on the water");
            };
        },
        flyMixin: function(obj){
            obj.fly = function(){
                console.log("Flying Woohoo");
            };
        }
    }
})();
</code>
</pre>
Note that you have an immediately invoked function expression (IIFE) that returns an object motionModule. This returned object contains all of the mixin behaviors as properties of the object.<br/>
The advantage of the module pattern is that all of the motion behaviors can be packaged into a single object that can then be used by other parts of your code. Here is an example using it:
<code>
motionModule.glideMixin(anyObject);
anyObject.glide();
</code>
Is Minitest::Assertions#assert Ever the Best Choice?
Tags: ruby, testing, minitest, assertions
Published: 2019-04-05 15:59:54

---
title: Is Minitest::Assertions#assert Ever the Best Choice?
published: true
description: 
tags: ruby, testing, minitest, assertions
---

I'm writing something about <code>Minitest::Assertions</code>, which causes me to wonder:

- Is there an occasion when a simple <code>assert(test)</code> could not be replaced by a more informative assertion?

For example:

- <code>assert(5 <= 4)</code> reports only <code>Expected false to be truthy.</code>

Whereas:

- <code>assert_operator(5, :<=, 4)</code> reports <code>Expected 5 to be <= 4.</code>

I have not been able to come up with an example where <code>assert</code> is the best we can do.

Thoughts?
CSS Is Hard - How do you learn to use and write CSS properly?
Tags: discuss
Published: 2019-04-05 15:39:37

---
title: CSS Is Hard - How do you learn to use and write CSS properly?
published: true
tags: discuss
---

The discussion on "Is CSS hard or not?" has been raging on Twitter for the past couple of years. There have been so many hot takes it's hard to keep track of but the conclusion seems to be the same: many people aren't sure how to structure their CSS and how to use it in a clean and scalable way.

I'd love to hear your tips and resources on where to go to learn to use CSS properly!
What is an else statement?
Tags: beginners, tutorial, learning, devtips
Published: 2019-05-31 10:05:45

---
title: What is an else statement?
published: true
tags: beginners, tutorial, learning, devtips
canonical_url: https://www.codetips.co.uk/beginner/what-is-an-else-statement/
---

> An else statement is a block of code to run when a condition is **not** met

 ![What is an else statement?](https://images.unsplash.com/photo-1516431883659-655d41c09bf9?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ)

In [What is an if statement?](https://codetips.co.uk/beginner/what-is-an-if-statement/) you were introduced to `if` statements. We posed a question ("_Should I go outside and take a walk?_") and wrote some [pseudocode](https://codetips.co.uk/beginner/what-is-pseudo-code/) on how this could be represented in an _`if`_ statement:

<!--kg-card-begin: markdown-->
```
if (takeWalkOutside) {
    // put on your shoes
}
```
<!--kg-card-end: markdown-->

But what if our logic wasn't as simple as this and instead we want to find out what shoes we should wear, based on the weather?

Luckily we only own two pairs of shoes, so our logic is still nice and simple: if it's raining outside, we want to wear our wellies, otherwise we'll wear trainers.

This is where we can use an `else` statement.

<!--kg-card-begin: markdown-->
```
if (raining) {
    // put on wellies
} else {
    // put on trainers
}
```
<!--kg-card-end: markdown-->

In this example, we'll perform the action (putting on trainers) whenever the `raining` condition is **not** met.

But what if we don't just own two pairs of shoes? What if we own sandals, for when it's sunny, and snow boots, for when it's snowing.

Using an `else` statement wouldn't help us achieve this. Currently, we're only checking if it's raining, every other situation will result in the same action (putting on trainers).

We can, however, use `else-if`. This will allow us to check for multiple conditions.

<!--kg-card-begin: markdown-->
```
if (raining) {
    // put on wellies
} else-if (snowing) {
    // put on snow boots
} else-if (sunny) {
    // put on sandals
} else {
    // stay indoors
}
```
<!--kg-card-end: markdown-->

Now we can check whether it's raining, snowing or sunny and wear the appropriate footwear.

Notice how we still have the `else` statement, but this time we're going to stay indoors if it's any other type of weather.
SyntaxError: import declarations may only appear at top level of a module
Tags: help
Published: 2019-04-05 14:38:04

---
title: "SyntaxError: import declarations may only appear at top level of a module"
published: true
tags: help
---

Hi guys, Im working on a tutorial project to skll my way up in ReactJS. Im stuck with an error related to webpack and babel that says 

"SyntaxError: import declarations may only appear at top level of a module"

Here's my package.json file:

{
"name": "reactjs-basics",
"version": "1.0.0",
"description": "Some basic ReactJS",
"main": "index.js",
"scripts": {
"start": "npm run build",
"build": "webpack -d && copyfiles src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot --history-api-fallback",
"build:prod": "webpack -p && copyfiles src/index.html dist/index.html"
},
"keywords": [
"reactjs"
],
"author": "Adam",
"license": "MIT",
"dependencies": {
"babel-core": "^6.26.3",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-logger": "^3.0.6"
},
"devDependencies": {
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-2": "^6.11.0",
"webpack": "^1.15.0",
"webpack-dev-server": "^1.16.5"
}
}

[webpack] [babel] [config]

Any help ?
Around the Web – 20190405
Tags: blog
Published: 2019-04-10 13:46:16

---
title: Around the Web – 20190405
published: true
tags: Blog
canonical_url: https://wipdeveloper.com/around-the-web-20190405/
cover_image: https://wipdeveloper.com/wp-content/uploads/2017/07/WIPDeveloper.com-logo-black-with-white-background.png
series: Around the Web
---

And now for somethings to read (or watch) over the weekend, if you have some spare time that is.

## [Good Day, Sir! Show: Frosted Tips](https://fireside.fm/s/uPWTgpSU+ZlZWHLrg)

**Fireside**  – Jeremy Ross – April 3rd, 2019 • 1 hr 53 mins • Download (77.8 MB) • Link with Timestamp In this episode, we discuss Mark Zuckerberg’s comments on regulation, Apple TV+, issues with multiple logins and community sites, succeeding and failing…

## [Tiamat’s Wrath (The Expanse)](https://www.amazon.com/gp/product/0316332879/ref=as_li_qf_asin_il_tl?ie=UTF8&tag=wipdevelope05-20&creative=9325&linkCode=as2&creativeASIN=0316332879&linkId=443d001a44268ec279ff9d1b070a957a)

The eighth book in the _NYT_ bestselling Expanse series, _Tiamat’s Wrath _finds the crew of the _Rocinante_fighting an underground war against a nearly invulnerable authoritarian empire, with James Holden a prisoner of the enemy. Now…

## [New WebKit Features in Safari 12.1](https://webkit.org/blog/8718/new-webkit-features-in-safari-12-1/)

**WebKit**  – Apr 5, 11:20 AM – There are many improvements and new web platform features in WebKit that are now available with the release of Safari 12.1, included with macOS Mojave 10.14.4 and iOS 12.2. This release delivers web platform features that improve website…

## [How to escape async/await hell](https://medium.freecodecamp.org/avoiding-the-async-await-hell-c77a0fb71c4c)

**freeCodeCamp**  – Aditya Agarwal – Apr 6, 2018, 8:41 PM – async/await freed us from callback hell, but people have started abusing it — leading to the birth of async/await hell. In this article, I will try to explain what async/await hell is, and I’ll also share some tips to escape…

## [Let’s Look at 50+ Interesting CSS Properties & Values](https://css-tricks.com/lets-look-50-interesting-css-properties-values/)

**CSS-Tricks**  – Jan 25, 2017, 10:51 AM – HelloSign: Everything IT requires and Developers love Can it be done with CSS? Do I need JavaScript? I know a lot of us ask these question when looking at designs and interactions. Recently I decided to dig into CSS and learn all of the properties.

## Till Next Week

Want to share something? Let me know by leaving a comment below or emailing [brett@wipdeveloper.com](mailto:brett@wipdeveloper.com)  or following and tell me on [Twitter/BrettMN](https://twitter.com/BrettMN).

Don’t forget to sign up for **[The Weekly Stand-Up!](https://wipdeveloper.com/newsletter/)** to receive free the [WIPDeveloper.com](https://wipdeveloper.com/) weekly newsletter every Sunday!

The post [Around the Web – 20190405](https://wipdeveloper.com/around-the-web-20190405/) appeared first on [WIPDeveloper.com](https://wipdeveloper.com).
TeamCity build times and npm
Tags: npm, teamcity, productivity
Published: 2020-06-22 09:35:04

---
title: TeamCity build times and npm
published: true
date: 2019-04-05 14:16:19 UTC
tags: npm,TeamCity, productivity
canonical_url: https://SimonReynolds.ie/teamcity-build-times-and-npm/
---

 ![TeamCity build times and npm](https://images.unsplash.com/photo-1516880711640-ef7db81be3e1?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjExNzczfQ)

Recently I noticed that project build times were getting longer and longer in work, taking up to 15 minutes to build and unit test an intranet solution. This quickly becomes unfeasible when you have a number of projects, with multiple branches and a non-infinite number of available build agents.

Examining the build logs quickly revealed the bottleneck...

![TeamCity build times and npm](https://simonreynolds.ie/content/images/2019/04/Before-2.png)<figcaption>npm install</figcaption>

Running `npm install` was taking over 7 minutes to complete!

Some searching revealed the existence of the `npm ci` command, documented [here](https://docs.npmjs.com/cli/ci.html).

Designed specifically for test, continuous integration and continuous deployment environments it will mostly ignore **package.json** , only checking that it matches what is in **package-lock.json** (or **package-shrinkwrap.json** ).

If there is a mismatch it will fail with an error instead of trying to create a new lock file. If everything matches up then it will restore from the lock file instead without having to do any dependency resolution.

It will delete any existing **node\_modules** folder to ensure a consistent restoration of all dependencies and is guaranteed to never write to **package.json** or any lock files.

So what effect does this have on our build times?

![TeamCity build times and npm](https://simonreynolds.ie/content/images/2019/04/After.png)<figcaption>npm ci</figcaption>

npm package restoration dropped from 7 minutes and 29 seconds to just 28 seconds! A 94% reduction in time and restoring some sanity and calm to a frustrated IT department.
Moving to new reporting tool
Tags: help
Published: 2019-04-05 13:55:17

---
title: Moving to new reporting tool
published: true
tags: help
---

Hi all,

I work as part of the IT team for a number of research studies.  My main study right now runs on Microsoft SQL Server 2017 and .NET web applications.

The reporting tool put in place forever ago was SQL Server 2008 SSRS - which unfortunately is rapidly approaching end of life.

I've spent a bit of time putting new reports directly into the web application and bypassing SSRS as much as possible, but the more requests that are coming in, the less workable that solution is.

What I'd like to do is move to some new reporting tool (basic grids of data with some light formatting [back color, text color etc.]).  All the table joins etc. are handled in the stored procedures in the database, so the reporting tool only needs to take the input and display it.

Must haves:

- Free (it is a non-big-pharma research study and the budget just isn't there)
- Can be embedded into another web-app (security not required)
- Can handle basic formatting of cells
- Can export to Excel (with formatting in place)
- Simple to use

Nice to haves [but not necessary]:

- A report designer would be helpful, but not a show-stopper so long as report definitions can be hand coded with relative ease
- Chart functions
- Open Source

Can anyone recommend anything, or am I asking a stretch too far considering my budget of.. well.. zero.

Thanks!
A new meeting goal
Tags: dailywriting
Published: 2019-04-09 01:23:59

---
title: A new meeting goal
published: true
tags: daily-writing
canonical_url: https://marcusblankenship.com/a-new-meeting-goal/
---

Back in the day, when I gathered my team for a meeting, it was because I had something to tell them.

A new project, direction, technology, or idea I’d conceived behind closed doors that I wanted to announce.

As we discussed it as a group, my idea would change. Morph into something better, or possibly entirely different.

Not just through the exchange of ideas, but through the process of dialogue with my team.

Afterword I remember thinking, _“When I called the meeting I thought I knew what I wanted and why. But, by the end, what I wanted and why changed. I wonder how that happened?”_

I stumbled on this quote last week while researching Relational Leadership, from Mikhail Bakhtin, which resonated with me. (Emphasis added by me.)

> _“Dialogue here is **not** the threshold to action, **it is the action itself.** _
> 
> _ **It is not a means for revealing,** for bringing to the surface the already-made character of a person; no, **in dialogue a person not only shows himself outwardly, but he becomes for the first time that which he is** – and, we repeat, not only for others but for himself as well._
> 
> _To be means to communicate dialogically.” (Bakhtin, 1984)_

Heady stuff, but worth considering.

This might also explain why I talk to myself throughout the day, a bit like a crazy person. And, it explains why when I write out my ideas, I find myself in a different place.

These are forms of dialoguing with myself.

The next time you sit down with your team, consider that the dialogue “is not a means for revealing” your ideas, but is how you discover and know your idea truly for the first time.

With that in mind, meetings with your team can take on a whole new purpose.

Share this with your team, and see what they think. ![🙂](https://s.w.org/images/core/emoji/11.2.0/72x72/1f642.png)

Best,  
Marcus

[[SPONSOR] My friend Cory Miller is starting a 5-week leadership group to help you manage better. I recommend you check it out.](https://corymiller.com/join-my-first-leadership-small-group/)

The post [A new meeting goal](https://marcusblankenship.com/a-new-meeting-goal/) appeared first on [Marcus Blankenship](https://marcusblankenship.com).
My work setup, what's yours?
Tags: webdev, discuss, showdev, beginners
Published: 2019-04-05 12:45:11

---
title: My work setup, what's yours?
published: true
description: Sharing my desk setup
tags: webdev, discuss, showdev, beginners
---

I feel like you can tell a lot about a person from there desk setup.

![](https://s3.amazonaws.com/linguine-code-cdn/media/workstation-1.jpg)

![](https://s3.amazonaws.com/linguine-code-cdn/media/workstation-2.jpg)

- I love soccer
- I like coffee
- My keyboard says gamer but my mouse says productivity??
- I'm religious (that's as far as I'll get into that)
- Water is a must
- I like photography
- I use Twitter a lot. A little bit too much.
- Rosetta Stone squishy ball for a bit of distraction
- I'm both a Windows and a Mac user.
- I'm somewhat scattered in my brain
- I'm on dev.to so that must mean I'm somewhat of a code nerd :)
- I have an air freshener on the right side, so I like a good smelling area
- I have gum, so good breath is a must

That was fun, what's your desk setup say about you?
EmberConf 2019 Videos Out
Tags: javascript, ember, beginners
Published: 2019-04-05 12:36:08

If you want to learn the latest [Ember](https://emberjs.com/) and its new edition [Octane](https://emberjs.com/editions/octane/), great news! Starting today, all recordings from this year's [EmberConf](https://emberconf.com/) are available on [YouTube](https://www.youtube.com/playlist?list=PLE7tQUdRKcyYWLWrHgmWsvzsQBSWCLHYL).

There are several talks in which the speaker shares their experience of switching career to development (I can relate to this), so please have a look!

[Playlist of EmberConf 2019 Talks](https://www.youtube.com/playlist?list=PLE7tQUdRKcyYWLWrHgmWsvzsQBSWCLHYL)
Best DEV.to Posts for Beginners: Week of March 31, 2019
Tags: codenewbie, beginners, tutorial, bestofdev
Published: 2019-04-05 11:56:24

---
title: Best DEV.to Posts for Beginners: Week of March 31, 2019
published: true
description: From learning plans to tutorials, these are some of the best beginner posts of the week!
tags: #codenewbie, #beginner, #tutorial, #bestofdev
series: Best DEV.to Posts for Beginners
cover_image: https://thepracticaldev.s3.amazonaws.com/i/x9acs27zebb19v5rf8ml.png
---

One of the reasons I've been so drawn to DEV.to over other platforms is the super encouraging and helpful community that gathers here. Initially I felt like it was going to be more a place where I sat back and watched, rather than write and contribute, but I've been so pleased to find not only helpful articles and tutorials that I understand, but also that input from new coders and devs is well-received.

I thought it would be nice to compile some of the best posts every week for those of us who still identify as #codenewbies!

(Since this is the first week, I'm playing it a little loose with the start and end dates. Forgive me!) 

{% link https://dev.to/csamywilliams_0/how-a-learning-plan-has-helped-me-grow-1app %}

This post about working out a learning plan couldn't have come at a better time for me. I've been working out my own personal code curriculum for #100DaysofCode for awhile, and my supervisor at work just mentioned writing one there as well. Amy's learning plan is very simple and easy to follow, and she's posted her template to share as well. 

{% link https://dev.to/ben/tell-me-about-a-time-you-messed-up-47an %}

Ben attempted a funny goof for April Fool's Day, and accidentally burned down the proverbial house. It's encouraging to know that even people we look up to mess up from time to time - truly no one is perfect. 

{% link https://dev.to/awwsmm/an-absolute-beginner-learns-react-2j0f %}

Andrew shares his thoughts while learning React knowing nothing about it. I'm going through essentially the same thought process he is, but on my end, it's Gatsby and Node, so I definitely relate!

{% link https://dev.to/maedahbatool/if-you-re-a-codenewbie-learning-javascript-this-is-what-you-should-learn-19m1 %}

Maedah posted a great, quick video breaking down some JavaScript and JSON concepts.

{% link https://dev.to/kylegalbraith/my-course-learn-aws-by-using-it-is-1-year-old-2e87 %} 

Interested in AWS? Learn AWS By Using it by Kyle Galbraith is a year old today, and he's offering not only discounts, but fun shirts! 

![To Do List with many baby steps: cook breakfast, clean up breakfast, work on drawing 1, work on drawing 2, etc.](https://media0.giphy.com/media/l8Kjo0Wbhyfni/giphy.gif)
We got this!
KVision v0.0.32
Tags: kvision, kotlin, websockets, webdev
Published: 2019-04-05 11:47:21

---
title: KVision v0.0.32
published: true
description: KVision is an open source web framework created for Kotlin/JS.
tags: kvision,kotlin,websockets,webdev
---

[KVision](https://github.com/rjaros/kvision) is an open source web framework created for Kotlin/JS. It allows developers to build modern web applications with the Kotlin language.

I have released KVision 0.0.32. Among other changes ([see changelog](https://github.com/rjaros/kvision/releases/tag/0.0.32)) there is support for type-safe websocket connections with the [Ktor](https://ktor.io/) server. The implementation is based on [Kotlin coroutine channels](https://kotlinlang.org/docs/reference/coroutines/channels.html), an experimental Kotlin feature. 

New release allows to easily develop full-stack applications with websockets communication between the server and the client. All in Kotlin, all fully type-safe. You can look at the simple [chat application example](https://github.com/rjaros/kvision-examples/tree/master/tweets-fullstack-ktor) and read the new [chapter in the documentation](https://kvision.gitbook.io/kvision-guide/part-3-server-side-interface/websockets) if you want to find more information.

Don't forget to ⭐️ my [project](https://github.com/rjaros/kvision) if you like it!

Any feedback is appreciated!
AI Consumer Insights: What companies are tracking? 
Tags: ai, artificial, intelligence, consumerinsights
Published: 2019-04-05 10:22:52

---
title: AI Consumer Insights: What companies are tracking? 
published: true
description: Artificial Intelligence is an ongoing trend which is hyped a lot but the perception of people is positive as well as negative. People are quite sceptical about the fact that AI can pose a threat to humans and their privacy which really depends on how we use AI. 
tags: AI, artificial, intelligence, consumer insights
---
<img src="https://thepracticaldev.s3.amazonaws.com/i/gpog8zjtfjtwjwcx0t64.png"/>

Artificial Intelligence is an ongoing trend which is hyped a lot but the perception of people is positive as well as negative. People are quite sceptical about the fact that AI can pose a threat to humans and their privacy which really depends on how we use AI. The fact that companies are tracking people’s activity to create targeted ads for more ROI (Return on investment) and it does not pose any threat to our privacy because the data is being shared with hidden identities. So, let’s discuss how, why & what companies are tracking about us.

Read the full article here: <a href="https://decipherzone.com/blog-detail/AI-Consumer-Insights--What-companies-are-tracking">AI Consumer Insights: What companies are tracking?</a>
PostgreSQL index a life savior  
Tags: postgres, scalingpostgresql
Published: 2019-04-05 07:46:03

---
title: PostgreSQL index a life savior  
published: true
description: How to scale postgres queries.
tags: PostgreSQL,scaling PostgreSQL
---

<img src="https://thepracticaldev.s3.amazonaws.com/i/epes6ehk5aa7bv24xqyq.jpg"/>

I am using postgres from last 1 year for my Django project. At the beginning of my project my database response is good but after some time when my project get some user it take more and more time. Then i start doing research to fix my response time. Then i found postgres index, we user postgres index to minimize the query cost. In postgres cost is related to pages. If their a large number of pages then the query cost is also high. For illustrate i will take a simple example that i posted on slideshare.

https://www.slideshare.net/manishyadav143341/postgre-sql-index
New release Vue Unicons added 60+ Brand & UI icons
Tags: vue, icons, githunt
Published: 2019-04-05 07:44:35

---
title: New release Vue Unicons added 60+ Brand & UI icons
published: true
description: New release Vue Unicons added 60+ Brand & UI icons
tags: vue, icons, githunt
cover_image: https://thepracticaldev.s3.amazonaws.com/i/22hdjd3v2p3xz88ijqt8.png
---

Hi, here!

Vue Unicons just released to 1.3.0 which added more than 60 Brand & UI icons

{% github antonreshetov/vue-unicons %}

![demo](https://thepracticaldev.s3.amazonaws.com/i/99nhgtyfu00tiwknudjm.gif)

Enjoy!