content: update content titles to match wanted format

This commit is contained in:
Jean-Philippe Sirois
2019-07-30 08:44:07 -04:00
parent 75a53a4919
commit 1be2818a08
6 changed files with 14 additions and 16 deletions
@@ -5,6 +5,6 @@ created_at: 2019/07/27
title: Callbacks
---
# Callbacks are everywhere
## Callbacks are everywhere
If you've been doing javascript for any amount of time you'll have noticed that callbacks appear in just about every single piece of code.
@@ -2,10 +2,9 @@
authors:
- "veksen#1060"
created_at: "2019/07/27"
title: Iterative vs Functional array helpers
---
# Iterative vs Functional array helpers
-- placeholder --
## find
@@ -9,14 +9,14 @@ recommended_reading:
- javascript/es6/arrow-functions
---
# A Promise to Keep
## A Promise to Keep
A `Promise` in Javascript represents an action that has already started, but one that will be
completed at a later time. Much like in real life, when you create a promise, you are expected
to fulfill that promise. However, sometimes things go wrong where you can no longer fulfill
a promise you made. This is essentially the main idea behind how promises work in javascript.
## Basics
### Basics
When you create a Promise or call a function that returns a Promise in Javascript, you're left
with an object that can either resolve into the actual value that you were promised, or it
@@ -24,7 +24,7 @@ can reject and leave you with an error for why that promise failed.
We can access these values using the `.then` and `.catch` methods on the `Promise` object respectively.
## A Simple Example
### A Simple Example
First, let's explore a bit of a made-up example. Imagine we have a promise-returning function
called `getMembers` that retrieves all the members in a discord server. When we execute this
@@ -50,7 +50,7 @@ getMembers("The Programmers Hangout").then(members => {
This way we are able to make sure that we only try to `console.log` when the `getMembers` function has resolved and ready to be used.
## Beginner Mistakes
### Beginner Mistakes
Promises are possibly the #1 most common source of confusion for beginners. In order
to avoid falling in pitfalls yourself, you have to remember 2 things about Javascript when
@@ -85,7 +85,7 @@ getWeather("Los Angeles").then(weather => {
})
```
## Real World Example
### Real World Example
Here is a real function that gets character information from the Rick and Morty API.
You can try it in your browser if you want to test it out.
@@ -2,10 +2,9 @@
authors:
- "Xetera#0001"
created_at: "2019/07/26"
title: Simplifying Promises
---
# Simplifying Promises
-- placeholder --
The first naive attempt, using new Promise for something that already returns a promise.
@@ -2,10 +2,9 @@
authors:
- "supergrecko#3434"
created_at: "2019/07/27"
title: Singletons
---
# Singletons
A singleton is a class which is only instantiated once during runtime. This is done by keeping a static property containing its instance on the singleton class.
There are multiple benefits to using a singleton class
@@ -16,7 +15,7 @@ There are multiple benefits to using a singleton class
By using a singleton instead of a static class we expose a cleaner class to use and we can use regular instance properties instead of static properties.
# Creating a Singleton in PHP
## Creating a Singleton in PHP
Creating a class which can be used as a singleton is very simple.
@@ -50,7 +49,7 @@ class Singleton
}
```
# Testing our Singleton
## Testing our Singleton
To give a little functionality to our freshly baked Singleton we add these three members to the class
@@ -93,7 +92,7 @@ $first->setWord("Banana");
var_dump($first->getWord() === $second->getWord()); // bool(true)
```
# Further Research
## Further Research
Here's a couple links which will help you understand Singletons better.
+2 -1
View File
@@ -2,9 +2,10 @@
authors:
- "Xetera#0001"
date: 2019/06/26
title: Some Python Article
---
# Python
## Python
This is a placeholder post