- Add concurrency.
- Now deal with it.
- Mutexes, somaphores, context switching
- Check for race condition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6.1101,17.592 | |
5.5277,9.1302 | |
8.5186,13.662 | |
7.0032,11.854 | |
5.8598,6.8233 | |
8.3829,11.886 | |
7.4764,4.3483 | |
8.5781,12 | |
6.4862,6.5987 | |
5.0546,3.8166 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"net/http" | |
"os" | |
) | |
const clientID = "<your client id here>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"sync" | |
"time" | |
) | |
// Worker pool is a collection of threads which are waiting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type SalaryCalculator interface { | |
CalculateSalary() int | |
} | |
type Permanent struct { | |
empId int |
docker run -d --name postgres -e POSTGRES_PASSWORD=Pass2020! -v postgres-data:/var/lib/postgresql/data -p 5432:5432 postgres:11-alpine
More env vars at https://hub.docker.com/_/postgres.
Hop into the container:
docker exec -it postgres bash
And use the psql repl.
I can run those tests on my local machine where I have mongo instance spinned up. But what about CI/CD services like Travis-CI?
How do I approach this?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function App() { | |
const [count, setCount] = React.useState(0) | |
function increment() { | |
setCount(prevCount => prevCount + 1) | |
} | |
function decrement() { | |
setCount(prevCount => prevCount - 1) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
constructor() { | |
super() | |
this.state = { | |
firstName: "", | |
lastName: "", | |
age: null, | |
location: "", | |
gender: "", | |
dietaryRestrictions: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
constructor() { | |
super() | |
this.state = { | |
character: {} | |
} | |
} | |
componentDidMount() { | |
this.setState({ loading: true }) |