Skip to content

Instantly share code, notes, and snippets.

View MohamedGouaouri's full-sized avatar
:octocat:
learning

MohamedGouaouri

:octocat:
learning
View GitHub Profile
#!/usr/bin/env python3
import os, sys, time, json, math, signal, subprocess, shlex
from datetime import datetime
from statistics import mean, pstdev
import requests
###############################################################################
# Env / defaults
###############################################################################
NODE_NAME = os.getenv("NODE_NAME", "") # required
package poweraware
import (
"bytes"
"encoding/json"
"fmt"
"os"
"gonum.org/v1/gonum/mat"
"k8s.io/klog/v2"
package poweraware
import (
"math"
"gonum.org/v1/gonum/mat"
)
func normalizeMatrix(matrix *mat.Dense) *mat.Dense {
r, c := matrix.Dims()
package poweraware
import (
"context"
"math"
"strconv"
"gonum.org/v1/gonum/mat"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Step 1: Basic Functional Component

Create a Message component that takes a text prop and displays it inside a <p> element.

// Message.js
import React from "react";

const Message = (props) => {
  return <p>{props.text}</p>;

Step 1: Basic Types

In TypeScript, basic types like number, string, and boolean can be explicitly declared.

const a: number = 0;

Step 2: Arrays and Type Checking in Functions

This task involves creating a function with typed parameters and testing the behavior when the wrong type is passed.

Example:

Blog app guided practice

Main Features of the Static Blog App:

  1. Blog Post List: Display a list of blog posts.
  2. Blog Post Detail View: Show details for a selected blog post.
  3. Search Functionality: Use hardcoded search functionality (no actual dynamic search or filtering).
  4. Static Styling: Use CSS Modules for styling.

Step-by-Step Guide to Build the Static Blog App

@MohamedGouaouri
MohamedGouaouri / docker-hands-on.md
Last active March 14, 2024 11:28
Docker hands-on

Docker Hands-on

Inspired by Tutorial

Part 1. Containers

  1. Check that docker is correctly running and that you have permission to use

Users API

1. Get User Information

  • Endpoint: GET /users/{userId}
  • Description: Retrieve information about a specific user.
  • Parameters:
    • userId (path parameter) - ID of the user to retrieve.
  • Response:
@Composable
fun <T> T.useDebounce(
delayMillis: Long = 300L,
// 1. couroutine scope
coroutineScope: CoroutineScope = rememberCoroutineScope(),
onChange: (T) -> Unit
): T{
// 2. updating state
val state by rememberUpdatedState(this)