Before following the guide, you should be familiar with GPG and Keybase... oh and Linux ofcourse!
The dollar sign($) means the terminal input.
- gpg # which is preinstalled in linux
- git
- zsh
- oh-my-zsh
| #!/usr/bin/env bash | |
| #shellcheck disable=SC2016 | |
| set -euo pipefail | |
| if [[ -z "${DOTLY_PATH:-}" ]] || ! output::empty_line > /dev/null 2>&1; then | |
| red='\033[0;31m' | |
| green='\033[0;32m' | |
| bold_blue='\033[1m\033[34m' | |
| normal='\033[0m' |
| ### Keybase proof | |
| I hereby claim: | |
| * I am jairofernandez on github. | |
| * I am jairokubeshop (https://keybase.io/jairokubeshop) on keybase. | |
| * I have a public key ASDaqSsHgv6cTBB8Ll3IR-MYWUkC0jo2_Q1hTOSUctX5vwo | |
| To claim this, I am signing this object: |
We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.
Let’s create our table driven test, for convenience, I chose to use t.Log as the test function.
Notice that we don't have any assertion in this test, it is not needed to for the demonstration.
func TestTLog(t *testing.T) {
t.Parallel()| { | |
| "AL": { | |
| "name": "Alabama", | |
| "capital": "Montgomery", | |
| "lat": "32.361538", | |
| "long": "-86.279118" | |
| }, | |
| "AK": { | |
| "name": "Alaska", | |
| "capital": "Juneau", |
| console.clear() | |
| // const reducer = (acumulador, valorActual) => nuevoAcumulador | |
| // valor inicial | |
| // const reducido = [1, 2, 3].reduce((acc, el) => acc + el, 0) | |
| // console.log(reducido) // 6 | |
| const numeros = [1, 2, 3, 4, 5] | |
| const resultado = numeros.reduce((acc, el) => acc + el, 0) | |
| // console.log(resultado) |
| import 'dart:math'; | |
| var rng = new Random(); | |
| void main(List<String> args) { | |
| final quantity = 1000; | |
| final stopwatch = Stopwatch()..start(); | |
| final products = createProducts(quantity); | |
| final users = createUsers(quantity); | |
| final usersIndexed = indexerListUser(users); |
| indexerListUser(List<dynamic> users) { | |
| final data = []; | |
| for (var i = 0; i < users.length; i++) { | |
| data.add({users[i]['id']: users[i]}); | |
| } | |
| return data; | |
| } |
| Distro: Ubuntu 20.04.1 LTS (Focal Fossa) | |
| Machine: Type: Laptop System: ASUSTeK product: N751JK v: 1.0 serial: <superuser/root required> | |
| Mobo: ASUSTeK model: N751JK | |
| CPU: Topology: Quad Core model: Intel Core i7-4710HQ bits: 64 type: MT MCP L2 cache: 6144 KiB | |
| Speed: 2503 MHz min/max: 800/3500 MHz Core speeds (MHz): 1: 2494 2: 2494 3: 2494 4: 2494 5: 2495 6: 2495 7: 2497 | |
| 8: 2495 | |
| Graphics: Device-1: Intel 4th Gen Core Processor Integrated Graphics driver: i915 v: kernel | |
| Device-2: NVIDIA GM107M [GeForce GTX 850M] driver: nouveau v: kernel | |
| Display: x11 server: X.Org 1.20.8 driver: modesetting unloaded: fbdev,vesa | |
| resolution: 1920x1080~60Hz, 1920x1080~60Hz, 1600x900~60Hz |
| badCombinatorFunction(List<dynamic> products, List<dynamic> users) { | |
| final data = []; | |
| for (var i = 0; i < products.length; i++) { | |
| final user = users.firstWhere((u) => u['id'] == products[i]['user']); | |
| data.add({ | |
| "id": products[i]['id'], | |
| "name": products[i]['name'], | |
| "user": user, | |
| }); |