Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
skbhardwaj committed Jul 20, 2023
0 parents commit b62170d
Show file tree
Hide file tree
Showing 48 changed files with 1,823 additions and 0 deletions.
Binary file added .assets/10_git_push.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/1_generate_repo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/2_open_codespaces.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/3_install_sdks.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/4_ext_html_preview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/5_ext_jbang.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/6_ext_kotlin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/7_ext_rockstar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/8_exec_jbang.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/9_git_stage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/MMST.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/button.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions .editorconfig
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[{*.yml,*.yaml}]
indent_size = 2
37 changes: 37 additions & 0 deletions .gitattributes
@@ -0,0 +1,37 @@
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

#
# The above will handle all files NOT found below
#
# These files are text and should be normalized (Convert crlf => lf)
*.bat text
*.css text
*.htm text
*.html text
*.java text
*.js text
*.json text
*.jsp text
*.properties text
*.sh text eol=lf
*.sql text
*.svg text
*.tld text
*.txt text
*.xhtml text
*.xml text
*.xsd text

# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.ear binary
*.gif binary
*.ico binary
*.jar binary
*.jpg binary
*.jpeg binary
*.png binary
*.war binary
11 changes: 11 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "gradle"
directory: "/kotlin-refactoring-challenge"
schedule:
interval: "daily"
open-pull-requests-limit: 10
19 changes: 19 additions & 0 deletions .github/workflows/verify-java-minimalist-challenge.yml
@@ -0,0 +1,19 @@
---
name: "Verify #3 Java Minimalist"
"on":
push:
paths:
- '3_Java_Minimalist/**'

jobs:
verify_challenge:
name: "Verify #3 Java Minimalist"
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout
uses: actions/checkout@v3

- name: Check Spec
uses: jbangdev/jbang-action@v0.109.0
with:
script: "3_Java_Minimalist/Spec.java"
21 changes: 21 additions & 0 deletions .github/workflows/verify-javascript-minimalist-challenge.yml
@@ -0,0 +1,21 @@
---
name: "Verify #4 JavaScript Minimalist"
"on":
push:
paths:
- '4_JavaScript_Minimalist/**'

jobs:
verify_challenge:
name: "Verify #4 JavaScript Minimalist"
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '4_JavaScript_Minimalist/.nvmrc'
- name: Check Spec
run: |
cd 4_JavaScript_Minimalist
./run.sh
26 changes: 26 additions & 0 deletions .github/workflows/verify-kotlin-refactoring-challenge.yml
@@ -0,0 +1,26 @@
---
name: "Verify #5 Kotlin Refactoring"
"on":
push:
paths:
- '5_Kotlin_Refactoring/**'

jobs:
verify_challenge:
name: "Verify #5 Kotlin Refactoring"
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout
uses: actions/checkout@v3

- name: 🛠️ Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: ⚙️ Run test
run: |
cd 5_Kotlin_Refactoring
./gradlew test --no-daemon
28 changes: 28 additions & 0 deletions .gitignore
@@ -0,0 +1,28 @@
# Eclipse project files
.classpath
.project
.settings

# IntelliJ project files
*.iml
.idea/

# VScode project files
.vscode/

# binary directories
bin
target
lib
build
.gradle/
pom.xml.versionsBackup
*.tgz
*.log
out/

# mac osx system files
*.DS_Store

# others
lsp/
30 changes: 30 additions & 0 deletions 1_Rockstar_Anagram/README.md
@@ -0,0 +1,30 @@
# #1 Rockstar Anagram

## Specification

Write a program that reads two words from user input and prints "true" if they are anagrams, i.e. contain the exact same letters (case insensitive), in the Rockstar programming language (https://github.com/RockstarLang).

Words considered anagrams:
```
foo/foo
foo/Foo
foo/oof
foobar/barfoo
Tom Vorlost Riddle/ist Lord Voldemort
```
(sorry for any spoilers)

Words not considered anagrams:
```
foo/bar
foo/of
foo/foobar
```

## Implementation

Please store your solution in the [challenge.rock](challenge.rock) file. You're free to use whatever (online) IDE and interpreter you find, it will be tested using [this one](https://codewithrockstar.com/online).

## Scoring

Solutions will be judged based on function (of course it should work) and the use of idiomatic Rockstar language with references to MediaMarktSaturn. Winner will be the working solution with the most literally valuable lyrics, praising MMS Technology.
Empty file.
116 changes: 116 additions & 0 deletions 2_Rockstar_FizzBuzz/README.md
@@ -0,0 +1,116 @@
# #2 RockBuzz

## Specification

Write a program that prints the numbers from 1 to 100 in the Rockstar programming language (https://github.com/RockstarLang). But for multiples of three print "Fizz", for multiples of five print "Buzz" instead of the number. For numbers which are multiples of both print "FizzBuzz" instead:

```
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
Fizz
22
23
Fizz
Buzz
26
Fizz
28
29
FizzBuzz
31
32
Fizz
34
Buzz
Fizz
37
38
Fizz
Buzz
41
Fizz
43
44
FizzBuzz
46
47
Fizz
49
Buzz
Fizz
52
53
Fizz
Buzz
56
Fizz
58
59
FizzBuzz
61
62
Fizz
64
Buzz
Fizz
67
68
Fizz
Buzz
71
Fizz
73
74
FizzBuzz
76
77
Fizz
79
Buzz
Fizz
82
83
Fizz
Buzz
86
Fizz
88
89
FizzBuzz
91
92
Fizz
94
Buzz
Fizz
97
98
Fizz
Buzz
```

## Implementation

Please store your solution in the [challenge.rock](challenge.rock) file. You're free to use whatever (online) IDE and interpreter you find, it will be tested using [this one](https://codewithrockstar.com/online).

## Scoring

Solutions will be judged based on function (of course it should work) and the use of idiomatic Rockstar language with references to MediaMarktSaturn. Winner will be the working solution with the most literally valuable lyrics, praising MMS Technology.
Empty file.
7 changes: 7 additions & 0 deletions 3_Java_Minimalist/Challenge.java
@@ -0,0 +1,7 @@
public class Challenge {

String weightedSort(String text) {
return "";
}

}
27 changes: 27 additions & 0 deletions 3_Java_Minimalist/README.md
@@ -0,0 +1,27 @@
# #3 Java Minimalist

## Specification

The task is to sort the words of a given text by a defined weight:

* A 'word' is defined as the group of characters not separated by whitespace, dash- or apostrophe-separated characters (like `dash-separated` or `Thomas's`) shall be considered as one word (dashes and apostrophes have no weight).
* The weight of a word is the sum of its characters ascii value (`aBc` = 98 + 66 + 99 = 263)
* Punctuation characters (`.`, `,`, `?`, `!` and so on) shall be ignored
* The words shall be sorted descending by their weight and outputted as distinct list as follows:
```text
<heavy word>|<weight>
<light word>|<weight>
```
If two words have exactly the same weight, they should be sorted descending by the ascii codes of their first character (on equality the second char, and so on).

It is disallowed to use any third party dependencies.

## Implementation

Please implement your solution by only changing the [Challenge.java](Challenge.java) file.
For testing your solution to fulfill the spec, just run the `run.sh` script after installing [jbang](https://www.jbang.dev/).

## Scoring

For rating the different solutions, the file size of `Challenge.java` will be measured under all solutions fulfilling the spec.
Smaller files are better, there are no rules other than defined here.
34 changes: 34 additions & 0 deletions 3_Java_Minimalist/Spec.java
@@ -0,0 +1,34 @@
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17+
//SOURCES Challenge.java
//FILES spec.properties
//DEPS org.assertj:assertj-core:3.24.2

import java.io.IOException;
import java.util.Arrays;
import java.util.Properties;

import static org.assertj.core.api.Assertions.*;

class Spec {

public static void main(String[] args) throws IOException{
var properties = new Properties();
properties.load(Spec.class.getResourceAsStream("/spec.properties"));

var challenge = new Challenge();

properties.entrySet().stream()
.filter(e -> e.getKey().toString().endsWith("input"))
.forEach(e -> {
var result = challenge.weightedSort(e.getValue().toString());
var resultLines = result.lines().toList();

var expected = properties.getProperty(e.getKey().toString().replace("input", "expected"));
var expectedLines = Arrays.asList(expected.split("\s+"));
assertThat(resultLines).containsExactlyElementsOf(expectedLines);
});

System.out.println("📯 It's a match! 🐝📝");
}
}
3 changes: 3 additions & 0 deletions 3_Java_Minimalist/run.sh
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

jbang Spec.java

0 comments on commit b62170d

Please sign in to comment.