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
| /* | |
| Exempel på validering av formulär | |
| Förbättringar: | |
| + Flytta valideringslogik till en separat hook för återanvändbarhet. | |
| + Lägg till fokus på första fel för bättre tillgänglighet: inputRef.current.focus() | |
| + Lägg till visuell feedback på input (t.ex. border-färg) för bättre UX. Återkoppla med mer än färg. | |
| */ | |
| import { useState } from "react"; |
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
| // App.jsx | |
| import { Suspense } from 'react' | |
| import './App.css' | |
| import Loading from './Loading' | |
| import Consumer from './Consumer' | |
| const App = () => ( | |
| <div> | |
| <Suspense fallback={<Loading />}> | |
| <Consumer /> |
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
| name: Python CI/CD | |
| # Talar om när jobben ska köras. Denna inställning bevakar när man gör push eller pull request mot branchen "main". | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: |
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
| SVG är ett bildformat, som man kan skriva med HTML-syntax. Eftersom den består av HTML-element kan man välja ut de ingående delarna med hjälp av JavaScript. | |
| Exempel | |
| Filen innehåller: | |
| <path id="scaffold" ...> | |
| Skriv i JS: | |
| const part1 = document.querySelector('#scaffold') | |
| part1.classList.add('css-klass som gör elementet osynligt') |
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
| import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; | |
| import { DynamoDBDocumentClient, GetCommand, PutCommand, ScanCommand } from "@aws-sdk/lib-dynamodb"; | |
| /* | |
| GetCommand används för att hämta en specifik Item i en Table. (AWS rekommenderar att man har allt i samma tabell.) | |
| ScanCommand kan hämta hela innehållet i en tabell. Opraktiskt om man har mycket data. | |
| PutCommand lägger till en ny Item. | |
| UpdateItemCommand ändrar en Item. | |
| DeleteCommand | |
| */ |
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
| /* Exempel på användning: | |
| import { ask } from './ask.ts' | |
| let x: string = await ask('Vilken är din favoritfärg? ') | |
| console.log('Du svarade: ' + x) | |
| */ | |
| import readline from 'node:readline' | |
| async function ask(query: string): Promise<string> { | |
| const rl = readline.createInterface({ input: process.stdin, output: process.stdout, tabSize: 4 }); |
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
| Feature: Musiksökning | |
| Som en användare av musiktjänsten | |
| Vill jag kunna söka efter musik | |
| För att hitta musik jag gillar | |
| Background: | |
| Given att jag är inloggad på musiktjänsten | |
| And att jag är på söksidan | |
| Scenario: Söka efter musik med giltigt sökord |
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
| /* | |
| Use this file in your project. | |
| But first, create a Node project: | |
| npm init -y | |
| Then add a line to package.json: | |
| "type": "module", | |
| Usage: |
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
| # Add your secrets here | |
| CONNECTION_STRING=yes-here |
NewerOlder