Skip to content

Commit

Permalink
Merge branch 'main' into mbtools/lasagna_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed Mar 29, 2024
2 parents f3f60a7 + 75a074d commit ad63502
Show file tree
Hide file tree
Showing 68 changed files with 647 additions and 323 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/no-important-files-changed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: No important files changed

on:
pull_request_target:
types: [opened]
branches: [main]
paths:
- "exercises/concept/**"
- "exercises/practice/**"
- "!exercises/*/*/.approaches/**"
- "!exercises/*/*/.articles/**"
- "!exercises/*/*/.docs/**"
- "!exercises/*/*/.meta/**"

permissions:
pull-requests: write

jobs:
check:
uses: exercism/github-actions/.github/workflows/check-no-important-files-changed.yml@main
with:
repository: ${{ github.event.pull_request.head.repo.owner.login }}/${{ github.event.pull_request.head.repo.name }}
ref: ${{ github.head_ref }}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ on:

jobs:
ci:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- name: Use Node.js LTS (16.x)
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
node-version: '16'
- run: npm install @abaplint/cli -g
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ This policy was initially adopted from the Front-end London Slack community and
A version history can be seen on [GitHub](https://github.com/exercism/website-copy/edit/main/pages/code_of_conduct.md).

_This policy is a "living" document, and subject to refinement and expansion in the future.
This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Slack, Twitter, email) and any other Exercism entity or event._
This policy applies to the Exercism website, the Exercism GitHub organization, any other Exercism-related communication channels (e.g. Discord, Forum, Twitter, email) and any other Exercism entity or event._
52 changes: 35 additions & 17 deletions bin/fetch-configlet.ps1
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
Function DownloadUrl ([string] $FileName, $Headers) {
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest"
$json = Invoke-RestMethod -Headers $Headers -Uri $latestUrl
$json.assets | Where-Object { $_.browser_download_url -match $FileName } | Select-Object -ExpandProperty browser_download_url
}
# This file is a copy of the
# https://github.com/exercism/configlet/blob/main/scripts/fetch-configlet.ps1 file.
# Please submit bugfixes/improvements to the above file to ensure that all tracks
# benefit from the changes.

Function Headers {
If ($GITHUB_TOKEN) { @{ Authorization = "Bearer ${GITHUB_TOKEN}" } } Else { @{ } }
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

$requestOpts = @{
Headers = If ($env:GITHUB_TOKEN) { @{ Authorization = "Bearer ${env:GITHUB_TOKEN}" } } Else { @{ } }
MaximumRetryCount = 3
RetryIntervalSec = 1
}

Function Arch {
If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" }
Function Get-DownloadUrl {
$arch = If ([Environment]::Is64BitOperatingSystem) { "x86-64" } Else { "i386" }
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest"
Invoke-RestMethod -Uri $latestUrl -PreserveAuthorizationOnRedirect @requestOpts `
| Select-Object -ExpandProperty assets `
| Where-Object { $_.name -match "^configlet_.+_windows_${arch}.zip$" } `
| Select-Object -ExpandProperty browser_download_url -First 1
}

$arch = Arch
$headers = Headers
$fileName = "configlet-windows-$arch.zip"
$outputDirectory = "bin"
$outputFile = Join-Path -Path $outputDirectory -ChildPath $fileName
$zipUrl = DownloadUrl -FileName $fileName -Headers $headers
if (!(Test-Path -Path $outputDirectory)) {
Write-Output "Error: no ./bin directory found. This script should be ran from a repo root."
exit 1
}

Write-Output "Fetching configlet..."
$downloadUrl = Get-DownloadUrl
$outputFileName = "configlet.zip"
$outputPath = Join-Path -Path $outputDirectory -ChildPath $outputFileName
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputPath @requestOpts

$configletPath = Join-Path -Path $outputDirectory -ChildPath "configlet.exe"
if (Test-Path -Path $configletPath) { Remove-Item -Path $configletPath }
[System.IO.Compression.ZipFile]::ExtractToDirectory($outputPath, $outputDirectory)
Remove-Item -Path $outputPath

Invoke-WebRequest -Headers $headers -Uri $zipUrl -OutFile $outputFile
Expand-Archive $outputFile -DestinationPath $outputDirectory -Force
Remove-Item -Path $outputFile
$configletVersion = (Select-String -Pattern "/releases/download/(.+?)/" -InputObject $downloadUrl -AllMatches).Matches.Groups[1].Value
Write-Output "Downloaded configlet ${configletVersion} to ${configletPath}"
2 changes: 1 addition & 1 deletion docs/LEARNING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Exercism provides exercises and feedback but can be difficult to jump into for those learning ABAP for the first time. These free resources can help you get started:

* SAP Learning Journey [Get Started with ABAP Programming](https://learning.sap.com/learning-journey/get-started-with-abap-programming-on-sap-btp)
* SAP Learning Journey [Learning the Basics of ABAP Programming](https://learning.sap.com/learning-journeys/learn-the-basics-of-abap-programming-on-sap-btp)
* [ABAP for Newbies Community](https://community.sap.com/topics/abap/abap-for-newbies)
* [ABAP Language Documentation](https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm)

Expand Down
10 changes: 5 additions & 5 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@
"docs": [
{
"uuid": "21b340f7-5709-4bfb-9e6f-b70e452c0d76",
"slug": "20-installation",
"slug": "installation",
"path": "docs/INSTALLATION.md",
"title": "Installing ABAP locally",
"blurb": "Learn how to install ABAP locally to solve Exercism's exercises on your own machine"
},
{
"uuid": "21a13a0d-687b-40d2-933e-d510241e10d8",
"slug": "10-learning",
"slug": "learning",
"path": "docs/LEARNING.md",
"title": "How to learn ABAP",
"blurb": "An overview of how to get started from scratch with ABAP"
},
{
"uuid": "e7aa0a32-7ee1-4a39-8f48-8f895ba2a4e9",
"slug": "30-tests",
"slug": "tests",
"path": "docs/TESTS.md",
"title": "Testing on the ABAP track",
"blurb": "Learn how to test your ABAP exercises on Exercism"
},
{
"uuid": "28d04b1a-195d-4633-9fb4-042f703a7d37",
"slug": "40-clone",
"slug": "clone",
"path": "docs/CLONE.md",
"title": "Clone the ABAP track",
"blurb": "Instructions on how to clone the ABAP track to your own system"
},
{
"uuid": "81756fdb-cbf1-4dd2-966f-59b820c447af",
"slug": "50-resources",
"slug": "resources",
"path": "docs/RESOURCES.md",
"title": "Useful ABAP resources",
"blurb": "A collection of useful resources to help you master ABAP"
Expand Down
12 changes: 6 additions & 6 deletions exercises/practice/acronym/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Description
# Instructions

Convert a phrase to its acronym.

Expand All @@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace)

For example:

|Input|Output|
|-|-|
|As Soon As Possible|ASAP|
|Liquid-crystal display|LCD|
|Thank George It's Friday!|TGIF|
| Input | Output |
| ------------------------- | ------ |
| As Soon As Possible | ASAP |
| Liquid-crystal display | LCD |
| Thank George It's Friday! | TGIF |
3 changes: 2 additions & 1 deletion exercises/practice/acronym/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
]
},
"blurb": "Convert a long phrase to its acronym.",
"source_url": "https://github.com/monkbroc"
"source_url": "https://github.com/monkbroc",
"source": "Julien Vanier"
}
6 changes: 3 additions & 3 deletions exercises/practice/affine-cipher/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Description
# Instructions

Create an implementation of the affine cipher, an ancient encryption system created in the Middle East.

The affine cipher is a type of monoalphabetic substitution cipher.
Each character is mapped to its numeric equivalent, encrypted with a mathematical function and then converted to the letter relating to its new numeric value.
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys.

[comment]: # ( monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic )
[//]: # " monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic "

## Encryption

Expand All @@ -23,7 +23,7 @@ Where:
For the Roman alphabet `m` is `26`.
- `a` and `b` are integers which make the encryption key

Values `a` and `m` must be *coprime* (or, *relatively prime*) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]).
Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]).
In case `a` is not coprime to `m`, your program should indicate that this is an error.
Otherwise it should encrypt or decrypt with the provided key.

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/affine-cipher/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
},
"blurb": "Create an implementation of the Affine cipher, an ancient encryption algorithm from the Middle East.",
"source": "Wikipedia",
"source_url": "http://en.wikipedia.org/wiki/Affine_cipher"
"source_url": "https://en.wikipedia.org/wiki/Affine_cipher"
}
17 changes: 11 additions & 6 deletions exercises/practice/anagram/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Description
# Instructions

An anagram is a rearrangement of letters to form a new word.
Given a word and a list of candidates, select the sublist of anagrams of the given word.
An anagram is a rearrangement of letters to form a new word: for example `"owns"` is an anagram of `"snow"`.
A word is not its own anagram: for example, `"stop"` is not an anagram of `"stop"`.

Given `"listen"` and a list of candidates like `"enlists" "google"
"inlets" "banana"` the program should return a list containing
`"inlets"`.
Given a target word and a set of candidate words, this exercise requests the anagram set: the subset of the candidates that are anagrams of the target.

The target and candidates are words of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `StoP` is not an anagram of `sTOp`.
The anagram set is the subset of the candidate set that are anagrams of the target (in any order).
Words in the anagram set should have the same letter case as in the candidate set.

Given the target `"stone"` and candidates `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, `"Seton"`, the anagram set is `"tones"`, `"notes"`, `"Seton"`.
3 changes: 2 additions & 1 deletion exercises/practice/anagram/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
]
},
"blurb": "Given a word and a list of possible anagrams, select the correct sublist.",
"source_url": "https://github.com/rchatley/extreme_startup"
"source_url": "https://github.com/rchatley/extreme_startup",
"source": "Inspired by the Extreme Startup game"
}
6 changes: 3 additions & 3 deletions exercises/practice/armstrong-numbers/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Description
# Instructions

An [Armstrong number][armstrong-number] is a number that is the sum of its own digits each raised to the power of the number of digits.

For example:

- 9 is an Armstrong number, because `9 = 9^1 = 9`
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1`
- 10 is _not_ an Armstrong number, because `10 != 1^2 + 0^2 = 1`
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
- 154 is _not_ an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`

Write some code to determine whether a number is an Armstrong number.

Expand Down
3 changes: 2 additions & 1 deletion exercises/practice/armstrong-numbers/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
]
},
"blurb": "Determine if a number is an Armstrong number.",
"source_url": "https://en.wikipedia.org/wiki/Narcissistic_number"
"source_url": "https://en.wikipedia.org/wiki/Narcissistic_number",
"source": "Wikipedia"
}
22 changes: 10 additions & 12 deletions exercises/practice/atbash-cipher/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Description
# Instructions

Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.

The Atbash cipher is a simple substitution cipher that relies on
transposing all the letters in the alphabet such that the resulting
alphabet is backwards. The first letter is replaced with the last
letter, the second with the second-last, and so on.
The Atbash cipher is a simple substitution cipher that relies on transposing all the letters in the alphabet such that the resulting alphabet is backwards.
The first letter is replaced with the last letter, the second with the second-last, and so on.

An Atbash cipher for the Latin alphabet would be as follows:

Expand All @@ -14,16 +12,16 @@ Plain: abcdefghijklmnopqrstuvwxyz
Cipher: zyxwvutsrqponmlkjihgfedcba
```

It is a very weak cipher because it only has one possible key, and it is
a simple mono-alphabetic substitution cipher. However, this may not have
been an issue in the cipher's time.
It is a very weak cipher because it only has one possible key, and it is a simple mono-alphabetic substitution cipher.
However, this may not have been an issue in the cipher's time.

Ciphertext is written out in groups of fixed length, the traditional group size
being 5 letters, and punctuation is excluded. This is to make it harder to guess
things based on word boundaries.
Ciphertext is written out in groups of fixed length, the traditional group size being 5 letters, leaving numbers unchanged, and punctuation is excluded.
This is to make it harder to guess things based on word boundaries.
All text will be encoded as lowercase letters.

## Examples

- Encoding `test` gives `gvhg`
- Encoding `x123 yes` gives `c123b vh`
- Decoding `gvhg` gives `test`
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
2 changes: 1 addition & 1 deletion exercises/practice/atbash-cipher/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
},
"blurb": "Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.",
"source": "Wikipedia",
"source_url": "http://en.wikipedia.org/wiki/Atbash"
"source_url": "https://en.wikipedia.org/wiki/Atbash"
}
Loading

0 comments on commit ad63502

Please sign in to comment.