fabiochiu/medium-articles huggingface dataset:
How life will change after the pandemic depends on all of us!
By: Zsolt Hermann
Tags: Change, Pandemic, Crisis, Education, Integration

How life will change after the pandemic depends on all of us! Zsolt Hermann Apr 25·1 min read

Question from the Internet:

“How will your life change after the pandemic?”

My life, your life, and everybody else’s life will change in the same way, since we exist in a fully integrated and interdependent world.

This is one of the greatest lessons the pandemic has shown us, besides all the other mounting global problems we are similarly unable to solve properly.

And the other lesson we need to learn — in order to have a good, safe, healthy, and sustainable life after the pandemic — is that we can’t solve or prevent the problems that threaten our existence as long as we continue reacting, “solving” everything through our inherently self-serving, self-justifying, egocentric and subjective worldview, calculations.

For solving, preventing problems, and safeguard our collective existence — and in this integral world only collective existence is possible, not at each other’s expense as we have been trying — we need to learn how to build positive, sustainable, mutually responsible, and mutually complementing interconnections, cooperation above and against our inherent nature.
Explaining Ramadhan to non-Muslims
By: Haris Fauzi
Tags: Peac, Ramadan, Muslim, Islam, Heart

Ramadhan Karem. ~ Sumber Gambar: Instagram Fakartun.

Muslims follow a lunar calender so the birth of a new moon signifies the beginning of a new month. Ramadhan is the name of the 9th month of the lunar calender. Fasting in this month is obligatory on all adult Muslims and is one of the 5 pillars of Islam.

Fasting is not a punishment. The ultimate aim is to attain consciousness of the Almighty, and there are many secondary health & spiritual benefits as well. Muslims fast from dawn until dusk, abstaining from any food and drink during that time frame. We eat a pre-dawn meal called suhoor break our fast with an evening meal at sunset called “iftaar”. After iftaar there is a special prayer called “taraweeh” (night prayer) in which our Holy book (Quran) is recited. The aim is to complete one full recitation of the Quran during this prayer over the course of the month. Ramadhan is the month of the Quran. Muslims are encouraged to spend more time pondering and reflecting over the messages contained within this Holy book.

Ramadhan is more than hunger, it’s a spiritual process. We pray more, eat less and give more charity. For most of us it’s is our fav time of the year. We exert our efforts and practice more good deeds than usual to gain the happiness of our Lord. Don’t minimize that by apologizing for us having to fast. It’s also ok for you to eat in front of us, so eat normally and don’t feel bad. Ramadhan is not a diet & the purpose isn’t weight loss. Fasting enables us to emphathize with the less fortunate and naturally become kinder, better human beings. It helps us to practice gratitude over things we take for granted It’s also an opportunity to re-examine our lives and actions over the past year and make intentions for self improvementand personal growth. We’re human beings and thus, are bound to err. We’ve made mistakes and many people wish for a do-over in life

Ramadhan is a chance to start over and repent over the mistakes of our past so we can begin anew. It’s like a spiritual spring cleaning and retreat- a special time for Muslims who focus on doing things sincerely for the pleasure of our Lord, attaining peace & contentment

Ramadhan is a difficult time for people who don’t get to spend it with family and friends. Be a safe space for your Muslim friends and co-workers by learning a little about ramadhan, providing them with prayer space and being understanding if they’re fatigued.

Islam places emphasis on our interactions with others. Its more than a religion bound by rules, its a way of life. All good actions are futile if we hurt the heart of another human being. Apologizing to those whom we have wronged is important
Time Crystal
By: Thamarasee Jeewandara
Tags: Soul, Lumiere, Light, Story, Heart

Mughal Emerald and Diamond Brooch, Circa 1829

One of the reasons I’ve enjoyed using this platform is due to it’s authenticity, the ability to write down what you feel, when the time is right, in your own words, in your own time. Keeping a record of your life as a form of self-expression is something that you owe your heart - the story-teller, the soul, who experiences the story in real-time, and you the reader who reads it in a different, appointed time. Facebook, I’ve enjoyed when I was younger (early to mid 20s), but with growth and experience, your views broaden and so, if you can do more, do more, if you can be more, be more. Not everyone has had to move through the high heavens and lower fires to get to where they are going, and therefore it can be difficult to understand another’s silence, or light, or awareness, but you only owe that experience and its expression or speaking of it, to your own self. This is why this platform with it’s visibility yet privacy has an old school charm to it.

I remember in the early 2010s, when blogs were first beginning to appear everywhere, I found the endearing, yet hilariously self-aware — ‘Rantings in Colombo’, where the author kept a lively record of her life and events in Colombo, albeit discretely/annonymously. Shout out to her if she sees this post! I remember how authentic the writing was and how she had embedded a playlist of music that included beautifully rustic Jazz, French ‘elevator music’ haha and French salon music, which I listened to while reading her posts, while sitting in a room scented with a fig-lime candle (I believe) at Lane Cove, Sydney. So, je ne sais quoi, so, parfaite. Thank you to her, whomever that was for sharing her life as a moment in time with me (and others), although the blog is now deleted as most blogs of the early 2000s were, I am glad I found that time-crystal, in time.

It is important to express yourself when the time is right, be it angry thoughts or self-indulgent rantings or self-appreciation, it is your soul speaking: your soul, your life, in your own time. This is why Jack Kerouac said that writing is a silent meditation, even though you’re going a 100 miles per hour. This is also why the Paris Review is a form of art (at times), and a time-crystal (for most parts).

Sometimes in life you must fly under the radar, sometimes you must shout from the mountain tops, and sometimes you must fly under the radar across mountain tops, haha! Then when you have the time, you sit down and write about your life to keep a record in time, to look back and understand the monumental moments that allowed you, and strengthened you to become who you are. Speak your truth, with grace in your heart and the light-that-never-left in your soul.

Amen.
10 Best Practices for a Healthy Heart
By: Transparent Hands
Tags: Healthy Lifestyle, Health, Healthcare, Heart

Introduction

Cardiovascular diseases are one of the major mortality causes, worldwide. While some of these diseases are manageable and are short term, the same is not the case with other ones. The old cliché statement which signifies the importance of prevention could not fit a more appropriate situation than this. So what are the Practices for a Healthy Heart?

If one is aware of their heart health status, they might be able to avert a bigger heart issue. A diet intervention in teen years might avert a cardiac intervention in years to come!

In this discussion, we are going to look at such practices which can improve anyone’s heart health. Try incorporating these in your lifestyle, you are promised some magical improvements. Even adopting half of these practices can have a wonderful impact on your heart health!

Practices for ideal heart health

So, without further ado, let’s have a look at the 10 best practices for a healthy heart!

1- Annual checkups

Going to a heart physician on your birthday isn’t exactly the ideal way of celebrating the big day. But hey, do schedule these regular checkups. For some people, the annual thing works. For some, a monthly visit is mandatory. Do whatever the doctor says or recommends in such sessions, and take prescribed medicines as well. Your doctor knows more about your heart health than you do!

2- Engage in physical activities

Exercise is considered a tribute to the heart. For all that pumping that it does, you must reward the heart by engaging in some physical activities yourself as well. However, do not overdo things. It is ideal to start with a 15 minutes jog daily. You can always increase the workload later. This routine will not put your heart under a lot of stress.

Get more information about Healthy Heart from the official website Transparent Hands Organization.
El Roi
By: Favour Archie-Bong
Tags: Christianity, Safety, Love, Children, Heart

El Roi

The giant clock ticked.

It ticked 12am, and I knew what it meant.

The name is MmeyeneAbasi Kufre, 21, 5ft 8 I think, fairly in between the dark and fair complexion, they say there’s nothing like chocolate complexion, else I’d have used that, I like to think I have the most beautiful green eyes you will ever come across and sitting safely on my head are purple tinted bouncy curls.

I sat close to the window in my empty 50sqm room, staring into oblivion and as the clock striked, I reached for my bag and dashed into the open. The wind received me harshly as her offsprings gnawed at my bare skin, my hands shot up immediately to protect my arms, but how much skin could it cover for I stood before the heavens as God created me, with the bag that held my doom.

The sound of a mouse scurrying past the cars parked by the road side drew my attention to a figure.

A figure! No!

No one was supposed to see me, I had it all planned out. I became jittery, Ikot Ansa shuts down at 10pm, who could that be at this time? I had planned it all, planned to drive the dagger in my bag through my neck and watch myself bleed to death. I was tired, tired of this life, tired of the constant abuse from my dad, tired of no one believing me even when I tried to speak up.

I even planned the outfit the Lord will receive me in, the very same cloth he dressed me in as I witnessed the first ray of light on earth, cos naked I came, naked I will go.

I looked at the car again and the figure was still there.

Anger.

It filled my heart and ate me whole. I knew what to do.

I reached for the dagger and started towards the car, whoever it is will go with me today, the Lord will receive two souls…I grinned, no I smirked, at least I won a soul.

As I drew closer to the car, I realized it was a blue Toyota Matrix. I loved the car.

I stopped in my tracks and began to tiptoe, then I saw him.

A child. I heard whimpers.

He was about 7 or 8 I don’t know, but then… What?

He had a dagger right in the spot I had planned to end my life.

In his neck.

Who could have done this?

I shuddered, too afraid to make another step. Anger vomited me, and sped off.

I stared at him…then he stretched his hand, a tear dropped. He beckoned on me, I moved closer and tried to pull out the dagger.

Then he spoke. He said “Mmeyene, I died so you won’t have to die, don’t kill me again”

I froze! Then He put my hands in His and said “Go! I have set you free!”

I wept! I knew who He was, I knew Him!

For anyone will know Jesus when they have an encounter with Him.
Expanding Awareness
By: Daniel F. Spomer
Tags: Inspiration, Social Sports, Community, Critical Thinking, Philosophy

Good Word, Season 1 Week 2

Have you ever noticed how different the positioning of the bocce balls looks from the far end of the court versus at the middle? Like when you toss a stone that lands in front and it’s completely obvious that it’s closer than one way off to the side… Until the referee call that side ball “still in” and you incredulously walk to center court to argue. That’s when you see it… Yeah, that side ball is definitely closer, by a lot.

Perspective is extremely important, but can do funny things. It allows you to see situations in different ways, though it always depends on where you stand. Awareness, on the other hand, is different. It goes beyond perspective… incorporating it, utilizing it, and then ultimately surpassing it. True Awareness is next level and sees from all sides at once.

When looking at balls on a court, perspective would tell you, “if I throw from this angle, I can knock that other ball out and I’ll be good.” It’s a simple, straight-line mentality. Where as Awareness takes other things into account, and would say, “if I take that path, I may get my ball in, but I’ll be left wide open and my opponents still have two stones to throw and could pick mine off and capitalize for a casino. Maybe I should throw a safety ball that’ll be hard to beat, and positioned so that if they try to knock me out, they could easily bust into my other ball laying behind.”

Sure, it’s a lot more complex. It requires imagination, and consideration of multiple perspectives at once. And it remembers that no action exists without some kind of consequence. But it’s absolutely worth it. Awareness is better informed, always more useful, and ultimately more successful. And not just on the bocce courts! Interacting with the rest of the world around you is made infinitely better by Awareness… it helps you accomplish your goals while still considering the needs of others. It anticipates the potential actions of those around you, and allows you to adjust accordingly.

So, I would encourage you, my sisters and brothers, to practice a little awareness this week! Even if it’s something as simple as laying down a smart defensive ball to limit your opponents’ scoring chances, or paying attention to where you’re standing so as to not block someone’s view, or cast a shadow on the court where another player is aiming. You might be amazed at the benefits of expanding your Awareness… both on the courts and off.

Lovingly Yours,

-The Reverend Bocce Spomer
I liked when you said this: 
“ I don’t mean to pick on this particular paper, or the author — who I…
By: Lucifer Daimon
Tags: Academic Writing, Writing, Critical Thinking, Philosophy, Academia

I liked when you said this:

“ I don’t mean to pick on this particular paper, or the author — who I happen to know is a very smart and nice individual — merely to give a flavor of what I mean when I say contemporary academic philosophy is almost wholly divorced from the messy world we live in.”

I’ve met a lot of people who sound like this. It’s as if they’re stuck in this bizarre “philosopher role-playing” fantasy game and can’t get out of character. And maybe they’re modelling other “dominant” personalities in their institution partly to “learn,” partly to conceal the insecurities they have with themselves (by hiding behind the face of the professor or celebrity academic). I’m not sure, exactly. But in any case, yea, it’s like they’re detached (or “divorced” as you say); trapped in a theatrical role that inherently negates reality to keep the make-believe alive.

The people that pretend they’re Zizek are pretty bad, in my humble opinion. (And that’s nothing against Zizek, himself.)

It’s like…if you’re making artful wordsalad like I do with some of my pieces, admit it! It’s fun. You do it for fun, not because you sincerely believe you’re the sole possessor of truth or something. But god please don’t put me through this without trying to (A) communicate something to someone other than yourself or (B) addressing a solid concern in human life…not just a purely personal desire for “one-upmanship” in the particular institution/discursive tradition of philosophy you serve, and were by chance (and privilege) exposed to.
How should you invest in your 20s & 30s?
By: Andrea Saliu
Tags: Finance, Financial Freedom, Millenial Finance, Money, Investing

3) Save & Understand Opportunity Cost

Photo by Sharon McCutcheon on Unsplash

Being young you are probably used to living on a limited budget, this is the easiest time to keep your costs low even though it’s tempting to do the opposite!

Let’s be honest, costs will only increase in the future (wedding, kids, medical expenses, etc.) so try to keep your expenditures as low as possible for as long as you can and save everything else you earn. Make it a challenge and make it automated so that it becomes much easier to resist to temptations. Most articles online say that you should save about 10% of your income but, of course, the more the better!

People always look for investments with incredible returns but forget to remember that avoiding expenses is an immediate return on your $ and it can add up to quite a lot over the years.

Example — You decide to buy a $1000 phone today:

The cost of the phone is actually not just the actual price of the phone, but it is also the opportunity cost of the $1000 spent on it, which will not be generating any returns in the future. By not investing this $1000, this phone will actually cost you $1967 in 10 years and $3870 in 20 years' time (taking an average return of 7% if you were to invest that money).

The same person, with the same initial financial means, can find themselves with $0 or $3870 with one simple decision. Do this 100 times throughout your lifetime and you can easily see the difference it can make.
The very often discussed topic of the 21st century.
By: Majka Fedorova
Tags: Financial Planning, Financial Freedom

The very often discussed topic of the 21st century. Becoming millionaire, billionaire, becoming rich. These terms are different from the term of wealth creation and in fact, even the underlying mindset varies.

When talking about becoming rich, we are purely talking about the luxury lifestyle and money. When considering the creation of wealth there is a fundamental desire to use money as a financial tool to obtain a valuable asset. Conversion of money for value and create a better future while improving your community.

Mindset

As mentioned, according to recent studies, being a millionaire and being wealthy is not the same in context and even the mindset is slightly different.

A lot of people want to retire early. But my question here is: ”What will you do then?” I leave a blank space for you to answer the question to yourself.

The fact is that most millionaires earned their money over time and most of them don’t want to retire since they love what they do. Very few became millionaires overnight. We all have heard about the exceptions such as lottery winners and those who inherit a big sum.

But if you don’t know how to manage your money first, it doesn’t matter whether you will receive a large sum of money, because it will not mean anything to you.

When building up slow step by step, you actually learn what to do and what not to do with the money you earn. But don’t let it be all just about the ‘’green paper’’. Being a great person with integrity and also considering the consequences of your business is what will bring you satisfaction.

When I was starting my corporate career, I didn’t have much experience. I was always interested in corporate law and companies’ functions. But at the law university, you get theoretical knowledge. In practice, I was getting more involved in the actual operations, banking services and investment. If you generate a large sum of money, you won’t just simply keep them on your bank account, since there is a certain limit after which you will need to pay negative interest on holding much larger sums.

Obviously, having this money, you will want to help to build schools, or care centres, invest in a portfolio of companies. The mindset here is about creation and caring about the common wellbeing.

Publishing the book on how to improve your financial habits to lead you toward a more satisfactory life. Coming out

Financial habits as Quality investment in yourself

Reach your Financial Freedom and enhance your personal development
Crypto & Us : Bite 2 (Blockchain)
By: Aditya Kohli
Tags: Decentralized Finance, Financial Freedom, Bitcoin, Cryptocurrency, Blockchain Technology

Think of Blockchain as a public ledger where all the cryptocurrency transactions that you do are recorded. These are recorded on blocks and these blocks are linked or ‘chained’ together forming a string of blocks. Now every transaction needs to be verified, like they are done in banks, except that here, these are verified by a network of P2P computers spread globally, also knows as ‘Miners’. Think of them as auditors who keep a check on the legitimacy of these transactions and in return are rewarded for the same in crypto. In this way, the whole process is ratified without any involvement of banks or financial institutions. Pretty cool right? How safe is blockchain, you may ask? Since the transactions on a block are verified from multiple networks or ‘nodes’ , even if the hacker tries to alter one transaction, he would need to hack at least half of the distributed nodes and on top of that, if he still manages to do that, since the blocks are independent, he would not be able to go past one block. So the net result is a publicly secured network with almost no room for error. Still need a reason to invest? The most effective and perhaps a life changing use case for blockchain technology is in the countries where banking facilities do not reach all the citizens or where inflation rates have soared to such an extent that their government currencies are worthless. Zimbabwe, Argentina and Lebanon are just a few examples from the long list of countries who are forced to switch to crypto and blockchain to survive. Transactions on blockchain are superior to the current system that we have seen throughout our lives. Be it in terms of security, privacy or efficiency, blockchain technology is a tremendous alternative for people who are looking to move to a more secure platform for people who want to have control on their money and privacy

PS: El Salvador, a small country in Central America took the historic decision to make Bitcoin a legal tender in the country which resulted in the whole country getting instant access to financial services, dramatically reducing the remittance fees and transaction time as compared to the earlier wire transfers. If that was not enough, the citizens will not be paying any tax on the capital gains, that means, as and when the value of bitcoin rises, the citizens benefit from the gains just buy holding bitcoin in their wallets.
5 Things you must do for a financial breakthrough
By: Great Mike
Tags: Financial Freedom, Wealth, Money

Most of us have no idea where our money is going. We think we know, but we don’t really know. This is doubly true for those who are married or live with a significant other. Ergo, the first step toward financial freedom is establishing a written monthly budget. Note the three key words here: written, monthly, and budget.

STEPS TO PLAN YOUR BUDGET TO ATTAIN FINANCIAL FREEDOM.

Categories

Identify what’s truly necessary by identifying all of your monthly expenses based on the past six months, and then divide your expenses into three categories: Need, Want, Like. Write down every expense (food, housing, utilities, insurance, cars, gas, transportation, clothes, credit cards, phones, Internet, pets, entertainment, etc.); triple-check the list with your significant other or a friend; and then use your Need, Want, Like categories to prioritize and cut wherever you can. The stricter you are, the sooner you’ll be free.

Boundaries.

Give every dollar a destination at the beginning of the month. By establishing these boundaries, you won’t worry about what you can and can’t purchase because the money that wasn’t assigned at the beginning of the month can’t be spent mid-month.

Teamwork leads to financial freedom.

Everyone in your household — even your children — must have a say in the written budget. This is the only way to get every person’s buy-in. Working together means taking from one category to fund another (e.g., extracting money from, say, your clothing budget to fund your entertainment budget) until each person is on the same page. Once everybody is on board — once everyone is committed to financial freedom — it is much easier to gain the traction you need.

Adjust for financial freedom.

You’ll have some slip-ups along the way. That’s all right, it’s part of the process. At first, you and your family should scrutinize your written budget daily, and then eventually weekly, adjusting accordingly until your whole family is comfortable with your set monthly allocations. The first month is the most difficult, but by the third month, you’ll curse yourself for wasting so much money during your budget-less days.

Safety.

Shit happens, so it’s best to create a Safety Net savings account with $500–$1000 for emergencies. Now listen: do not touch this money unless there is a true emergency (car repairs, medical bills, job loss, etc.). Your Safety Net will allow you to stay on budget even when life punches you in the face. Over time, once you’re out of debt, your Safety Net will grow to include several months of income. But for now, worry only about the first $500–$1000 to start, which you’ll want to keep in a separate Safety Net account to avoid temptation.

Learn More

“Sharing is Godly and Sharing is Caring”
Why Sukanya Samriddhi Yojana (SSY) exists & Who should invest in SSY? : Ch2
By: Mr. Lokesh Tiwari
Tags: Financial Services, Sukanya Samriddhi Scheme, Financial Freedom, Breakthechain, Financial Planning

As per the 2011 Census of India literacy rate was 74.4% with a wide gender disparity in the literacy rate in India and effective literacy rates were 84.7% for men and 70.3% for women. The low female literacy rate has a dramatically negative impact on financial disparity.

The gender-wise distribution of wealth in India is highly asymmetric, and it’s decidedly tilted towards men. Women own just between 20% and 30% of the overall household wealth in the country — much less than the global share of 40%. (“Women and wealth” by James Davies and Anthony Shorrocks published in the Global Wealth Report 2018)

In India “It is understood that a woman’s primary role is to take care of the house and her family and any income-generating work is secondary to this role,” it added.

The study also found that cutting taxes on wealth predominantly benefits men who own 50% more wealth than women globally, and control over 86% of corporations.

Unpaid work done by women across the globe amounts to a staggering $10 trillion a year, which is 43 times the annual turnover of the world’s biggest company Apple, an Oxfam study.
KISS YOUR WORRIES GOODBYE — TOP 5 OPEN SECRETS TO WEALTH CREATION & FINANCIAL FREEDOM THAT ARE…
By: Anyeyure Adongo
Tags: Social Media Marketing, Financial Freedom, Wealth Creation, Affiliate Marketing, Dropshipping

KISS YOUR WORRIES GOODBYE — TOP 5 OPEN SECRETS TO WEALTH CREATION & FINANCIAL FREEDOM THAT ARE BENEFITING MILLIONS OF PEOPLE

Wealth creation, and by extension Financial freedom has long been one of the primary motivational factors for individuals within any society. Humans are naturally inclined towards the pursuit of prosperity and wealth, due to the gathering of resources being highly effective in aiding one’s chances of survival throughout the prehistoric years of our species. Consequently, millions and millions of people including students, the unemployed youth, disgruntled employees, and those looking to retire in dignity all fret about how they can live the lives they so desire. Yet for all of the fluff and aspiration, there are very few individuals out there who have a solid understanding of financial freedom; and perhaps more importantly, how to achieve it.

This article will seek to do its part in changing the status quo of ignorance regarding financial freedom, by revealing what the subject is as well as methods to go about achieving it; in turn, helping all of you out there that may feel lost get a little more control over your own lives.

Continue here https://personalwealthcreators.com/kiss-your-worries-goodbye-top-5-open-secrets-to-wealth-creation-financial-freedom-that-are-benefiting-millions-of-people/
Problems we are solving at @onethousandADU
By: Preston Rutherford
Tags: Purpose, Financial Freedom, Real Estate, Mission, Investing

Problems we are solving at @onethousandADU

Housing Affordability crisis — Not enough Supply

Solution / Approach

State ADU regulations completely transform the risk and timeline associated with building new units on existing parcels.

May approach is to build new units on existing cash-flowing multifamily parcels. Limiting the value add risk.

Problem / Significance

Housing Affordability crisis — Too expensive

Solution / Approach

Building needs to evolve in the same way other technologies have evolved

Pre fabricated, factory built housing is far faster and less expensive than traditional construction

Problem / Significance

Energy crisis

Fossil fuels cause climate change

Shutoffs

and increases rates 8% yr

Solution / Approach

We will power the ADUs with renewable energy sources

We will be grid independent and self sustaining

Protected from inevitable rate increases and shutoffs.

Problem / Significance

Wealth distribution crisis — Access to asset ownership is minimal

Solution / Approach

Residents will become investors in the ownership entity of the property

Start the snowball of wealth-building

Problem / Significance

Wealth distribution crisis — Disproportionately low representation by minority investors (women and people of color)

Solution / Approach

Find and train operators of color and female operators and educate them & help them do this.

Help them become independently wealthy change The trajectory of their life, and expand access to their American Dream
JavaScript Hoisting
By: Darryl Mendonez
Tags: Var, JavaScript, Hoisting, ES6

JavaScript Hoisting

In JavaScript, before any code is executed there is a hoisting phase that occurs which lifts all var variable and function declarations to the top of their functions. This can be quite confusing since JavaScript runs its code line by line. This leads to functions being able to call variables seemingly before they are even declared. To add to the confusion, it is only the declaration of the variable that gets hoisted and not its assigned value. Because of this, it will naturally assign the the value of the variable to be undefined . This is why it’s a best practice to manually declare your variables at the top of their functions or global scope instead of having JavaScript do it for you. This makes it easier for you and your collaborators to understand the scope of the variables. This is also why ES6 introduced let and const variables which do not get hoisted to the top but instead have block scoping. By using let and const to declare variables you are more conscious of their scope and you are not polluting the global scope. Understanding these behaviors and abiding by best practices will save you a lot of headaches and perhaps even payoff literally as most times web developer interviews will include a question or challenge that will test your knowledge of hoisting.

Let’s start off simple:
遇到 async，別用 forEach
By: Steven Chen
Tags: Async, JavaScript, Asyncawait, Frontend Development, ES6

Photo by Paweł Bukowski on Unsplash

開始之前，請打開我在 codepen上準備的範例:

Editor / Full Page

用 forEach來處理異步(asynchronous)的情況會怎樣?

多點幾次範例上的 ForEach按鈕，你會發現每次輸出 1st, 2nd跟 3rd的順序都不一樣。

這種難以事先預測結果的狀態，就是異步的 race condition。

為什麼會這樣?

先看一下 mozilla文件上對 forEach的描述:

arr.forEach(function callback(currentValue[, index[, array]]) {

//your iterator

}[, thisArg]);

這是因為 forEach並不會在乎 callback function是不是 async functrion(也就是他的 return是不是一個 promise)、也不會等到 promise被 resolve或 reject才執行下一次迴圈。

你可以把 forEach想像成是:

Array.prototype.forEach = function (callback) {

// this represents our array

for (let index = 0; index < this.length; index++) {

// We call the callback for each entry

callback(this[index], index, this);

}

};

可以看到 function前面沒有 async、 callback前面也沒有 await。

這樣就算傳入的是一個 async function也沒有用:

texts.forEach(async text => {

const res = await addSuffix(text);

console.log(res);

})

網路上常見的做法是自己寫一個 asyncForEach:

async function asyncForEach(array, callback) {

for (let index = 0; index < array.length; index++) {

await callback(array[index], index, array);

}

}

或者也可以改用 for/for-in/for-of再自己加上 async/await:

for(let i = 0; i < texts.length; i += 1) {

const res = await addSuffix(texts[i]);

console.log(res);

} for (let i in texts) {

const res = await addSuffix(texts[i]);

console.log(res);

} for (let text of texts) {

const res = await addSuffix(text);

console.log(res);

}

參考資料:

JavaScript: async/await with forEach() by Sebastien Chopin
My React App final project.
By: Rudy Dwayne Ravelin
Tags: Active Admin, React, ES6, Ruby on Rails

Rails is an incredible framework, but modern web development has moved to the front-end, meaning sometimes you don’t need all the bulk of the asset pipeline and the templating system. In Rails 5 you can now create an API-only Rails app, meaning you can build your front-end however you like — using Create React App.

Technologies that I used.

In this project, I used those technologies above to make this simple App.

1-Active Admin is a Ruby on Rails framework for creating elegant backends for website administration. Check out the docs. Try the live demo.

Create React App

You’ll need to have Node 8.10.0 or later on your local development machine (but it’s not required on the server). You can use nvm (macOS/Linux) or nvm-windows to easily switch Node versions between different projects.

To create a new app, you may choose one of the following methods:

npx

npx create-react-app my-app

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

npm

npm init react-app my-app

npm init <initializer> is available in npm 6+

Yarn

yarn create react-app my-app

yarn create is available in Yarn 0.25+

It will create a directory called my-app inside the current folder.

Inside that directory, it will generate the initial project structure and install the transitive dependencies:

my-app

├── README.md

├── node_modules

├── package.json

├── .gitignore

├── public

│ ├── favicon.ico

│ ├── index.html

│ └── manifest.json

└── src

├── App.css

├── App.js

├── App.test.js

├── index.css

├── index.js

├── logo.svg

└── serviceWorker.js



No configuration or complicated folder structures, just the files you need to build your app.

Once the installation is done, you can open your project folder:

cd my-app

Using Rails for API-only Applications

Traditionally, when people said that they used Rails as an “API”, they meant providing a programmatically accessible API alongside their web application. For example, GitHub provides an API that you can use from your own custom clients.

With the advent of client-side frameworks, more developers are using Rails to build a back-end that is shared between their web application and other native applications.

For example, Twitter uses its public API in its web application, which is built as a static site that consumes JSON resources.

Instead of using Rails to generate HTML that communicates with the server through forms and links, many developers are treating their web application as just an API client delivered as HTML with JavaScript that consumes a JSON API.
React for Angular Developer (part 2)
By: Sy Truong
Tags: Web Development, JavaScript, Angular, ES6, Reactjs

Component

React components are similar to Angular directives, they are used to abstract complex DOM structures and break them down behaviorally for reuse. For example, to do a slide show with Angular.

// index.html

<div ng-controller="SlideShowController">

<slide-show slides="slides">

</slide-show>

</div> // slide-show.html

<div class="slideshow">

<ul class="slideshow-slides">

<li ng-repeat="slide in slides" ng-class="{ active: $index == activeIndex }">

<figure>

<img ng-src="{{ slide.imageUrl }}" />

<figcaption ng-show="slide.caption">{{ slide.caption }}</figcaption>

</figure>

</li>

</ul>

<ul class="slideshow-dots">

<li ng-repeat="slide in slides" ng-class="{ active: $index == activeIndex }">

<a ng-click="jumpToSlide($index)">{{ $index + 1 }}</a>

</li>

</ul>

</div> // js

app.controller("SlideShowController", function($scope) {

$scope.slides = [{

imageUrl: "image.jpg",

caption: "This is image" },{

imageUrl: "image.jpg",

caption: "This is image" }];

});

app.directive("slideShow", function() {

return {

restrict: 'E',

scope: {

slides: '='

},

template: 'slide-show.html',

link: function($scope, element, attrs) {

$scope.activeIndex = 0;

$scope.jumpToSlide = function(index) {

$scope.activeIndex = index;

};

}

};

});

Whereas with React, the component will be rendered inside another component, exchanging data with each other via props.

let _slides = [{

imageUrl: "image.jpg",

caption: "This is image"

}, {

imageUrl: "image.jpg",

caption: "This is image"

}];

class App extends React.Component {

render() {

return <SlideShow slides={ _slides } />

}}

class SlideShow extends React.Component {

constructor() {

super()

this.state = { activeIndex: 0 };

}

jumpToSlide(index) {

this.setState({ activeIndex: index });

}

render() {

return (

<div className="slideshow">

<ul className="slideshow-slides">

{

this.props.slides.map((slide, index) => (

<li className={ classNames({ active: index == this.state.activeIndex }) }>

<figure>

<img src={ slide.imageUrl } />

{ slide.caption ? <figcaption>{ slide.caption }</figcaption> : null }

</figure>

</li>

))

}

</ul>

<ul className="slideshow-dots">

{

this.props.slides.map((slide, index) => (

<li className={ (index == this.state.activeIndex) ? 'active': '' }>

<a onClick={ (event)=> this.jumpToSlide(index) }>{ index + 1 }</a>

</li>

))

}

</ul>

</div>

);

}

}

React component contains state within it (this.state), which you can modify by calling this.setState({ key: value}). Any change to the component’s state causes it to re-render itself.

Events in React look like old-school styles, like inline event handler like onClick or similar. But don’t think like it’s boring, because React is actually trying to gain performance from these points, which creates high performance delegated event listeners.
Spread Love !!! Spread Peace !!! with (…Spread) Operator in JavaScript
By: Saumik Sarkar
Tags: JavaScript, Javascript Development, Spread Operator, ES6, Javascript Tips

With greater power comes even greater responsibilities

Over the last few years, there has been a massive transition of programmers who switched to JavaScript from other programming languages and the best part is JavaScript did not disappoint and kept on evolving.

JavaScript has massively improved its syntax and functionality with additional features over the last few years. With ES6, JavaScript introduced a bunch of features and one of them is the Spread Operator aka … Operator.

Confused with the three dots ??? Yes that’s what Spread Operator looks like

Let’s take a look at what Spread Operator does.

Photo by Amy Shamblen on Unsplash

MDN Definition:

Spread syntax ( ... ) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.

Syntax:

Its syntax is pretty straight forward just add three dots

const numbers = [1, 2, 3];

console.log(...numbers); OUTPUT: 1 2 3

Spread Operator can be used for three different cases:

Function Calls

myFunction(...iterableObj);

2. Array Literals

[...iterableObj, '4', 'five', 6];

3. Object Literals
Javascript merge arrays without duplicates
By: Filippo Rivolta
Tags: JavaScript, Front End Development, Arrays, ES6, Javascript Tips

A few days ago I wrote a code that involved merging two large arrays without duplicates. My first reaction was to write a reduce function that initiated the accumulator, looped every element and checked whether it was already in the array:

Performance speed: 0.2749999985098839 milliseconds.

This solution worked well for me, but I wondered if I could improve the performance a little more, and ended up with a few solutions.

For testing purposes, each described method uses the same arrays:

also I will check the execution speed at the end of every function with performance.now().

First solution

The traditional way to accomplish the task is to initialize an empty result array that contains the result items, create a loop for each array that has to be merged, and store the current element in the result array if it is not present. The presence is checked using indexOf that will return -1 if not.

Performance speed: 0.41500001680105925 milliseconds.

Second solution

Using ES5 we can merge the two input arrays without removing the duplicates with .concat() and then loop again through the result array and remove duplicates using indexOf.

Performance speed: 0.5300000193528831 milliseconds.

Third solution

Overall, the reduce method at the beginning still has the better performance. Between the last two solutions there is no significant difference in complexity and execution speed, but the second is cleaner and easier to read. We can go a step further and take into account the ES6 Set feature, which takes all values from an iterable object, in our case an array, but since every element in a set must be unique in the collection, it skips the duplicates without any effort for us.

When creating a Set keep in mind that null is treated like undefined and that it is a different concept from an array: a Set is a “keyed collection” while the second is an “indexed collection”

Here is the code:

Performance speed: 0.13499998021870852 milliseconds.

Since we don’t want the result to be a new Set we will just destructure it into an array.

Conclusion

The last solution is what I was looking for, it is the most readable and it has the lowest complexity, which brings a great performance compared to the other two. I ended up bringing that piece of code into my application abstracting it into a new function. Thanks, I hope this was helpful enough ;)
JavaScript Polyfill: Object.assign()
By: Iamsonika
Tags: JavaScript, Objects In Javascript, ES6, Object Assign

As we know, Polyfill is the most asked question in the interviews, and Object.assign() is one of them.

First, we need to understand, what Object.assign() do and where we can use it?

Object.assign() copies the values (of all enumerable own properties) from one or more source objects to a target object.

Ex: Object.assign(target, …sources)

const obj = { a: 1 };

const copy = Object.assign({}, obj);

console.log(copy); // { a: 1 }

and now will see where we usually use

where ever we want to shallow copy the object so that it won't affect the parent object.

one of the core principles of Redux is to never mutate state, you’ll often find yourself using Object. assign() to create copies of objects with new or updated values.

Now we will implement Polyfill of Object.assign(),

target is the place where all source1, source 2 will get merge or overide the property.

is the place where all source1, source 2 will get merge or overide the property. nextSource is source1, source2…. we give in the second parameter of Object.assign

is source1, source2…. we give in the second parameter of Object.assign we need to use for loop to loop through all sources(source1, source2, …)

to loop through all sources(source1, source2, …) To loop through, we will use arguments whose starting index is 1.

whose starting index is 1. new for loop to copy the all sources property to newTo object

to copy the all sources property to object and finally, we will return newTo object, where we will have all the property of source1, source2, …etc.

Summary
10 Javascript questions for your next Interview!
By: Habibul Hasan
Tags: JavaScript, React, ES6, Interview, Js

What is virtual DOM in react? if you can answer they will ask what is the use of it? if you can pass they will ask what is reconciliation and diffing algorithm. What are polyfills? if you can answer, they will ask to write bind or filter-like functions for polyfills. What is block scope, can you give an example? what is shadowing? how many scopes are there in JS? Can you explain how the JS engine works, what is JS Runtime? Tell us how Event loops work. What is a closure? give an example. what are the uses of closure? What is async and defer! how they affect your HTML page rendering sequence. What is a critical rendering path? explain What is throttle and debounce? can you explain their differences and uses? What is event bubbling? how does the JS DOM event work? bubbling vs capturing. What is a first-class function, what is a higher-order function? what are some basic pillars of functional programming, how it is different than OOP, what is your feeling about FP?

some extra

** ES 6 features and later improvements

Async-await and callbacks

React redux-thunk if you are from reacting ecosystem.

Data type in JS

session storage vs local-storage

freeze and seal in JS

Object spreading, rest params.

let vs const vs var and hoisting.

how object cloning works in JS [that is related with spreading]

Thanks for reading! share if it helps.

Some of the best resources
Map and Object Performance Comparison
By: Cda Sharer
Tags: Development, JavaScript, Front End Development, ES6, Performance

Map and Object have their own characteristics, and we should make different choices for different situations.

Using map

When storing keys that are not strings/numbers/ or Symbols, choose Map because Object does not support it.

When storing large amounts of data, choose Map because it takes up less memory.

When you need to do a lot of add/delete operations, choose Map because it is faster.

If you need to keep the order of insertion, choose Map because Object will change the ordering.

If you need to iterate/traverse, choose Map because it is an iterable object by default and it is easier to iterate.

Using object

For simple data structures, choose Object because it takes up less memory when there is less data and is more efficient when creating new ones.

When you need to use JSON for file transfer, choose Object because JSON does not support Map by default.

When you need to perform operations on multiple keys, choose Object because the syntax is more concise.

Choose Object when you need to override keys on a prototype.

Summary

While a Map can be more efficient than an Object in many cases, an Object will always be the most basic reference type in JS, and it’s not just for storing key-value pairs.
JavaScript : ES6 or Modern JavaScript Crash Course
Tags: Beginner, JavaScript, Angular, React, ES6

🔥🔥🔥🔥

One must know the ES6 or Modern JavaScript Concepts before you working on Angular or React

Learn Essential ES6 Crash Course in just one Hour with all practical scenarios.

New ES6 syntax

00:00 Introduction to ES6

00:40 Let keyword

04:12 Const keyword

04:45 Default Parameters

07:13 Rest Operator

09:06 Spread Operator

11:10 Object Literal

13:20 Template Literal

15:16 for of

Destructuring

17:02 Array Destructuring

22:12 Obect Destructuring

Modules in JavaScript

25:43 Modules in Javascript

25:46 What is Modules ?

26:05 Create Module

27:27 Export function constructor and functions

28:26 Import Module

Class in JavaScript

31:40 Need of class in JavaScript

33:50 Create an Object of Class

35:40 Getter & Setter

38:53 Inheritance in Javascript

Arrow Functions

45:40 Introduction to Arrow functions

46:12 Create Arrow Function

46:53 With Single Parameter

47:15 With Zero Parameter

48:02 How this works in Arrow functions

53:57 Arguments with Arrow functions

55:13 When to use arrow functions

Promise in JavaScript

55:36 Introduction to Promise

55:42 What is Promise ?

56:24 Life cycle of Promise

57:22 Crete Promise

1:01 Consuming Promise

1:05:00 Catching Error

1:06:21 Finally

1:06:42 Attach handlers

1:07:51 Chaining Promise