diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 3c0e816..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: deploy - -on: - push: - branches: - - main - -jobs: - test: - runs-on: ubuntu-22.04 - environment: garage - steps: - - uses: actions/checkout@v4 - - name: Copy website - run: | - mkdir dist - files=$(git ls-files | grep -E '\.(html|css|js)$') - cp --parents $files ./dist - - name: Deploy website - run: | - aws configure set default.s3.addressing_style path - aws s3 sync ./dist s3://womangling.noratrieb.dev - env: - AWS_ACCESS_KEY_ID: "${{ secrets.AWS_KEY_ID }}" - AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_KEY }}" - AWS_REGION: garage - AWS_ENDPOINT_URL: https://garage.noratrieb.dev diff --git a/flashcard.js b/flashcard.js index e6888ee..8761135 100644 --- a/flashcard.js +++ b/flashcard.js @@ -1,18 +1,19 @@ +const randomItem = (not) => { + let item; + + do { + const idx = Math.floor(Math.random() * window.ITEMS.length); + item = window.ITEMS[idx]; + } while (not && item === not); + + return item; +}; + const infoText = document.querySelector("#info-text"); function next() { infoText.textContent = ""; - - const candiates = [...window.ITEMS]; - - const nextRandomItem = () => { - const idx = Math.floor(Math.random() * candiates.length); - const result = candiates[idx]; - candiates.splice(idx, 1); - return result; - }; - - const item = nextRandomItem(); + const item = randomItem(); const mangle = Math.random() > 0.5; @@ -23,10 +24,10 @@ function next() { children[1].textContent = mangle ? item.means : item.mangle; const options = [ - nextRandomItem(item), - nextRandomItem(item), - nextRandomItem(item), - nextRandomItem(item), + randomItem(item), + randomItem(item), + randomItem(item), + randomItem(item), ]; const correctIdx = Math.floor(Math.random() * options.length); options[correctIdx] = item; diff --git a/lesson-1.html b/lesson-1.html index 61b1dd1..bc73a47 100644 --- a/lesson-1.html +++ b/lesson-1.html @@ -31,7 +31,7 @@ Every C++ mangled symbol is prefixed with the string _Z. This signifies that this is a mangled C++ symbol. _Z starts with an underscore followed by an uppercase - letter. All symbols of that structure are reserved by the C + letter. All symbols of that structures are reserved by the C standard and cannot be used by programs. This ensures that there are no name collisions with normal C functions and mangled C++ functions.