diff --git a/CHANGELOG.md b/CHANGELOG.md index c13f38f..3a22f7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # CHANGELOG -#### 2.1.2 +#### 3.0.0 -- CSS improvement +- Restarting diff --git a/README.md b/README.md index c370c75..f2892fd 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ report any issues, bugs or suggestions [here](https://github.com/irfanshadikrish
Meow - +
#### _Installation_ diff --git a/assets/preview/meow-2.0.1.JPG b/assets/preview/meow-2.0.1.JPG deleted file mode 100644 index 4cdb35e..0000000 Binary files a/assets/preview/meow-2.0.1.JPG and /dev/null differ diff --git a/assets/preview/meow_1.png b/assets/preview/meow_1.png new file mode 100644 index 0000000..ad0a50b Binary files /dev/null and b/assets/preview/meow_1.png differ diff --git a/experiments/.gitattributes b/experiments/.gitattributes index 70e63ff..84e9ac6 100644 --- a/experiments/.gitattributes +++ b/experiments/.gitattributes @@ -1,2 +1,49 @@ # Set default behavior to automatically normalize line endings. * text=auto + +# Force text files to have Unix-style LF endings +*.sh text eol=lf +*.bash text eol=lf +*.md text eol=lf +*.yml text eol=lf +*.yaml text eol=lf + +# Ensure consistent line endings for Windows-style CRLF +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Treat all files with the following extensions as binary +*.jpg binary +*.png binary +*.gif binary +*.exe binary +*.dll binary + +# Handle specific file types differently +*.txt text diff +*.json text diff +*.xml text diff +*.html text diff + +# Ignore line ending normalization for certain files +*.zip -text +*.tar.gz -text +*.tar.bz2 -text + +# Force diff for certain file types, even if they are binary +*.pdf diff +*.doc diff +*.docx diff + +# Exclude certain directories from Git processing +node_modules/* -text +dist/* -text +build/* -text + +# Custom settings for specific files +/path/to/specific/file.txt text eol=lf +/path/to/another/file.bat text eol=crlf + +# Set attributes for all files in a directory +subdir/* text eol=lf diff --git a/experiments/.vscodeignore b/experiments/.vscodeignore new file mode 100644 index 0000000..f369b5e --- /dev/null +++ b/experiments/.vscodeignore @@ -0,0 +1,4 @@ +.vscode/** +.vscode-test/** +.gitignore +vsc-extension-quickstart.md diff --git a/experiments/LICENSE.md b/experiments/LICENSE.md new file mode 100644 index 0000000..2c7b981 --- /dev/null +++ b/experiments/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2023, Irfan Shadik Rishad + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/experiments/bash.sh b/experiments/bash.sh index 2992369..bfdb43f 100644 --- a/experiments/bash.sh +++ b/experiments/bash.sh @@ -1,77 +1,123 @@ #!/bin/bash -echo hello World -echo "hello world" +# Simple echo statements +echo "Hello World" +echo "Hello, world!" -hello(){ - echo hello world -} -function hello_world(){ - echo hello world +# Function definitions +hello() { + echo "Hello World from the hello function" } -hello args1 args2 "args3" 'args4' +function hello_world() { + echo "Hello World from the hello_world function" +} -This_Is_A_Variable=/some/thing +# Calling functions with arguments +hello "arg1" "arg2" "arg3" "arg4" -echo $This_Is_A_Variable -read First_Name +# Variable declaration and usage +This_Is_A_Variable="/some/thing" +echo "This variable contains: $This_Is_A_Variable" -echo $First_Name +# Reading input +read -p "Enter your first name: " First_Name +echo "Your first name is: $First_Name" -# for loop -for (( c=1; c<=5; c++ )) -do +# For loop +for (( c=1; c<=5; c++ )); do echo "Welcome $c times" done -# case statement -echo -n "Enter the name of a country: " -read COUNTRY - +# Case statement +read -p "Enter the name of a country: " COUNTRY echo -n "The official language of $COUNTRY is " case $COUNTRY in - Lithuania) - echo -n "Lithuanian" + echo "Lithuanian" ;; - Romania | Moldova) - echo -n "Romanian" + echo "Romanian" ;; - Italy | "San Marino" | Switzerland | "Vatican City") - echo -n "Italian" + echo "Italian" + ;; + Germany) + echo "German" + ;; + France) + echo "French" ;; - *) - echo -n "unknown" + echo "unknown" ;; esac -# while loop +# While loop a=7 -while [ $a -gt 4 ]; -do - echo $a +while [ $a -gt 4 ]; do + echo "Value of a: $a" ((a--)) done +echo "Out of the loop" -echo "Out of the loop" - -# awk +# Awk example awk '{ print $0 }' filename.txt -# sed +# Sed example sed -i "s/from/to/g" filename.txt -hello_world +# Calling another function +hello_world -echo systeminfo | grep "System Boot Time" +# Grep system information +echo "System Boot Time:" +echo systeminfo | grep "System Boot Time" +# Array usage ARRAY=(one two three four five) - -echo $ARRAY # prints only the first item -echo ${ARRAY[@]} # prints all the items -echo ${ARRAY[0]} ${ARRAY[3]} # prints specific item +echo "First item: ${ARRAY[0]}" +echo "All items: ${ARRAY[@]}" +echo "Specific items: ${ARRAY[0]} and ${ARRAY[3]}" + +# Appending and printing array elements +ARRAY+=("six" "seven") +echo "Extended array: ${ARRAY[@]}" + +# Arithmetic operations +NUM1=10 +NUM2=5 +SUM=$((NUM1 + NUM2)) +DIFF=$((NUM1 - NUM2)) +MUL=$((NUM1 * NUM2)) +DIV=$((NUM1 / NUM2)) +MOD=$((NUM1 % NUM2)) + +echo "Sum: $SUM" +echo "Difference: $DIFF" +echo "Product: $MUL" +echo "Division: $DIV" +echo "Modulus: $MOD" + +# Conditional statements +if [ $NUM1 -gt $NUM2 ]; then + echo "$NUM1 is greater than $NUM2" +else + echo "$NUM1 is not greater than $NUM2" +fi + +# File operations +touch testfile.txt +echo "This is a test file." > testfile.txt +cat testfile.txt + +# Checking if a file exists +if [ -f testfile.txt ]; then + echo "File testfile.txt exists." +else + echo "File testfile.txt does not exist." +fi + +# Cleanup +rm testfile.txt diff --git a/experiments/c.c b/experiments/c.c index 0725012..fa5983d 100644 --- a/experiments/c.c +++ b/experiments/c.c @@ -1,5 +1,16 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PI 3.14159 +#define BUFFER_SIZE 1024 struct threeNum { @@ -7,29 +18,87 @@ struct threeNum float g1; }; +void printHelloWorld() { + printf("Hello, World!\n"); +} + +int factorial(int n) { + if (n <= 1) return 1; + else return n * factorial(n - 1); +} + int main() { - int n; - struct threeNum num; - FILE *fptr; - - if ((fptr = fopen("C:\\program.bin","rb")) == NULL){ - printf("Error! opening file"); - - // Program exits if the file pointer returns NULL. - exit(1); - } - - // Moves the cursor to the end of the file - fseek(fptr, -sizeof(struct threeNum), SEEK_END); - - for(n = 1; n < 5; ++n) - { - fread(&num, sizeof(struct threeNum), 1, fptr); - printf("n1: %d\tn2: %d\tn3: %d\n", num.n1, num.n2, num.n3); - fseek(fptr, -2*sizeof(struct threeNum), SEEK_CUR); - } - fclose(fptr); - - return 0; -} \ No newline at end of file + // Variable declarations + int n, i; + double result; + char buffer[BUFFER_SIZE]; + struct threeNum num; + FILE *fptr; + + // Function call + printHelloWorld(); + + // File operations + if ((fptr = fopen("C:\\program.bin","rb")) == NULL){ + printf("Error! opening file\n"); + exit(1); + } + + // Moves the cursor to the end of the file + fseek(fptr, -sizeof(struct threeNum), SEEK_END); + + for(n = 1; n < 5; ++n) + { + fread(&num, sizeof(struct threeNum), 1, fptr); + printf("n1: %d\tn2: %d\tn3: %d\tg1: %.2f\n", num.n1, num.n2, num.n3, num.g1); + fseek(fptr, -2*sizeof(struct threeNum), SEEK_CUR); + } + fclose(fptr); + + // Math operations + result = pow(PI, 2); + printf("PI squared: %.2f\n", result); + + // String operations + strcpy(buffer, "C Programming"); + printf("Buffer content: %s\n", buffer); + + // Character operations + char c = 'A'; + if (isalpha(c)) { + printf("%c is an alphabetic character.\n", c); + } + + // Boolean and conditional + bool flag = true; + if (flag) { + printf("Flag is true\n"); + } else { + printf("Flag is false\n"); + } + + // Looping constructs + for (i = 1; i <= 10; i++) { + printf("Factorial of %d: %d\n", i, factorial(i)); + } + + // Constants and limits + printf("Maximum value for int: %d\n", INT_MAX); + printf("Minimum value for float: %.10e\n", FLT_MIN); + + // Assertion + assert(factorial(5) == 120); + + // Time operations + time_t t; + time(&t); + printf("Current time: %s", ctime(&t)); + + // Random number generation + srand((unsigned) time(NULL)); + int randomNum = rand() % 100; + printf("Random number: %d\n", randomNum); + + return 0; +} diff --git a/experiments/cpp.cpp b/experiments/cpp.cpp index 77cbf88..3cc2a76 100644 --- a/experiments/cpp.cpp +++ b/experiments/cpp.cpp @@ -1,26 +1,110 @@ #include +#include +#include +#include +#include +#include +#include +#include + using namespace std; + +void printMessage(const string &message) { + cout << message << endl; +} + +class Base { +public: + virtual void show() { + cout << "Base class show function" << endl; + } + virtual ~Base() = default; +}; + +class Derived : public Base { +public: + void show() override { + cout << "Derived class show function" << endl; + } +}; + +int factorial(int n) { + if (n <= 1) return 1; + else return n * factorial(n - 1); +} + int main() { + // Basic pointer operations int var = 5; + int* pointVar = &var; - // declare pointer variable - int* pointVar; + cout << "var = " << var << endl; + cout << "Address of var (&var) = " << &var << endl << endl; + cout << "pointVar = " << pointVar << endl; + cout << "Content of the address pointed to by pointVar (*pointVar) = " << *pointVar << endl; - // store address of var - pointVar = &var; + // Dynamic memory allocation + unique_ptr ptr = make_unique(10); + cout << "Value of dynamically allocated memory: " << *ptr << endl; - // print value of var - cout << "var = " << var << endl; + // Array and vector usage + int arr[] = {1, 2, 3, 4, 5}; + vector vec(arr, arr + 5); - // print address of var - cout << "Address of var (&var) = " << &var << endl - << endl; + cout << "Array elements: "; + for (int i : arr) { + cout << i << " "; + } + cout << endl; - // print pointer pointVar - cout << "pointVar = " << pointVar << endl; + cout << "Vector elements: "; + for (int i : vec) { + cout << i << " "; + } + cout << endl; + + // String manipulation + string str1 = "Hello"; + string str2 = "World"; + string str3 = str1 + " " + str2; + cout << "Concatenated string: " << str3 << endl; + + // Exception handling + try { + if (str3.empty()) { + throw runtime_error("String is empty"); + } else { + printMessage("String is not empty"); + } + } catch (const exception &e) { + cerr << "Exception: " << e.what() << endl; + } + + // Inheritance and polymorphism + Base *basePtr = new Derived(); + basePtr->show(); + delete basePtr; + + // Mathematical operations + double result = pow(PI, 2); + cout << "PI squared: " << result << endl; + + // Time operations + time_t now = time(0); + char* dt = ctime(&now); + cout << "The current date and time is: " << dt; + + // Sorting with lambda function + sort(vec.begin(), vec.end(), [](int a, int b) { return a > b; }); + cout << "Sorted vector in descending order: "; + for (int i : vec) { + cout << i << " "; + } + cout << endl; + + // Factorial calculation + int n = 5; + cout << "Factorial of " << n << " is " << factorial(n) << endl; - // print the content of the address pointVar points to - cout << "Content of the address pointed to by pointVar (*pointVar) = " << *pointVar << endl; - return 0; } diff --git a/experiments/csharp.cs b/experiments/csharp.cs index 83d7b87..855b119 100644 --- a/experiments/csharp.cs +++ b/experiments/csharp.cs @@ -1,35 +1,92 @@ using System; -namespace SealedClass { - class Animal { - public virtual void makeSound() { - Console.WriteLine("Animal Sound"); +namespace SealedClass +{ + class Animal + { + public virtual void makeSound() + { + Console.WriteLine("Animal Sound"); + } } - } - class Dog : Animal { + class Dog : Animal + { + sealed public override void makeSound() + { + Console.WriteLine("Dog Sound"); + } + } + + class Puppy : Dog + { + public override void makeSound() + { + Console.WriteLine("Puppy Sound"); + } + } + + class Program + { + static void Main(string[] args) + { + Puppy d1 = new Puppy(); + Console.ReadLine(); + } + } + + class Example + { + public int publicVar = 10; + private int privateVar = 20; + protected int protectedVar = 30; + internal int internalVar = 40; + protected internal int protectedInternalVar = 50; + private protected int privateProtectedVar = 60; + public static int staticVar = 70; + public readonly int readonlyVar = 80; + public const int constVar = 90; + public volatile int volatileVar; + public new int publicVar = 100; - // sealed method - sealed public override void makeSound() { + public void ModifyValues(ref int refVar, out int outVar, in int inVar) + { + refVar = 200; + outVar = 300; + } + } + + public abstract class AbstractClass + { + public abstract int AbstractProperty { get; set; } + public abstract void AbstractMethod(); + } - Console.WriteLine("Dog Sound"); + public class DerivedClass : AbstractClass + { + public override int AbstractProperty { get; set; } + public override void AbstractMethod() { } + public sealed int sealedVar = 500; } - } - class Puppy : Dog { + public unsafe class UnsafeExample + { + public int* pointerVar; + } + + public partial class PartialClass + { + public int partialVar; + } - // trying to override sealed method - public override void makeSound() { - Console.WriteLine("Puppy Sound"); + public class ExternExample + { + public extern void ExternMethod(); } - } - class Program { - static void Main (string [] args) { - - // create an object of Puppy class - Puppy d1 = new Puppy(); - Console.ReadLine(); + public async Task AsyncMethod() + { + await Task.Delay(1000); + return 600; } - } -} \ No newline at end of file +} diff --git a/experiments/css.css b/experiments/css.css index bccabce..69f75f6 100644 --- a/experiments/css.css +++ b/experiments/css.css @@ -1,63 +1,89 @@ -@import url("googlefonts"); -@import url("googlefonts"); +@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap"); +@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap"); +/* Universal selector to reset margin and padding */ * { margin: 0; padding: 0; + box-sizing: border-box; } /* CSS Comment */ +/* Root variables for theme colors */ :root { - --color: whitesmoke; - --background: #252525; + --color: #f5f5f5; + --background: #2d2d2d; + --primary-color: #007bff; + --secondary-color: #6c757d; + --border-radius: 4px; } +/* Global styles for the body element */ body { - font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, - Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; + font-family: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, + "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", + sans-serif; background-color: var(--background); color: var(--color); + line-height: 1.6; } +/* Styles for a class with various properties */ .classname { font-size: 1rem; - border: none; - margin: 1px 1px; - padding: 2fr 1pt; + border: 1px solid var(--primary-color); + border-radius: var(--border-radius); + margin: 1rem; + padding: 1rem; aspect-ratio: 16/9; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + transition: background-color 0.3s ease; } +/* Styles for an ID with flexbox layout */ #id { - max-width: fit-content; + max-width: 100%; display: flex; flex-direction: column; gap: 10px; + padding: 1rem; } +/* Focus-visible styles for accessibility */ .classname_again:focus-visible { - outline: none; + outline: 2px solid var(--secondary-color); + outline-offset: 4px; } +/* Input element styles */ input { - color: palegreen; - background-color: transparent; - border: none; - outline: none; + color: #2c3e50; + background-color: #ecf0f1; + border: 1px solid #bdc3c7; + border-radius: var(--border-radius); + padding: 0.5rem; } +/* Media query for responsive design */ @media screen and (max-width: 750px) { .container { - width: 70%; + width: 90%; margin: 0 auto; } } -@keyframes animation { +/* Keyframes for animation */ +@keyframes slide-down { from { - top: 0px; + transform: translateY(-100%); } to { - top: 200px; + transform: translateY(0); } } + +/* Animation applied to elements */ +.animated-element { + animation: slide-down 0.5s ease-out; +} diff --git a/experiments/go.go b/experiments/go.go index 21499b7..85d502b 100644 --- a/experiments/go.go +++ b/experiments/go.go @@ -2,40 +2,96 @@ package main import ( "fmt" + "time" + "math" ) +// Define a struct for Person with field tags type Person struct { - name string - age int - job string - salary int + Name string `json:"name"` + Age int `json:"age"` + Job string `json:"job"` + Salary int `json:"salary"` +} + +// Method to display Person information +func (p Person) DisplayInfo() { + fmt.Printf("Name: %s\n", p.Name) + fmt.Printf("Age: %d\n", p.Age) + fmt.Printf("Job: %s\n", p.Job) + fmt.Printf("Salary: %d\n", p.Salary) +} + +// Function to calculate the average salary +func averageSalary(salaries ...int) float64 { + var total int + for _, salary := range salaries { + total += salary + } + return float64(total) / float64(len(salaries)) } func main() { - var pers1 Person - var pers2 Person - - // Pers1 specification - pers1.name = "Hege" - pers1.age = 45 - pers1.job = "Teacher" - pers1.salary = 6000 - - // Pers2 specification - pers2.name = "Cecilie" - pers2.age = 24 - pers2.job = "Marketing" - pers2.salary = 4500 - - // Access and print Pers1 info - fmt.Println("Name: ", pers1.name) - fmt.Println("Age: ", pers1.age) - fmt.Println("Job: ", pers1.job) - fmt.Println("Salary: ", pers1.salary) - - // Access and print Pers2 info - fmt.Println("Name: ", pers2.name) - fmt.Println("Age: ", pers2.age) - fmt.Println("Job: ", pers2.job) - fmt.Println("Salary: ", pers2.salary) + var pers1 Person + var pers2 Person + + // Pers1 specification + pers1 = Person{ + Name: "Hege", + Age: 45, + Job: "Teacher", + Salary: 6000, + } + + // Pers2 specification + pers2 = Person{ + Name: "Cecilie", + Age: 24, + Job: "Marketing", + Salary: 4500, + } + + // Access and print Pers1 info + fmt.Println("Person 1 Information:") + pers1.DisplayInfo() + + // Access and print Pers2 info + fmt.Println("\nPerson 2 Information:") + pers2.DisplayInfo() + + // Calculate and print average salary + avgSalary := averageSalary(pers1.Salary, pers2.Salary) + fmt.Printf("\nAverage Salary: %.2f\n", avgSalary) + + // Working with time + now := time.Now() + fmt.Printf("\nCurrent Time: %s\n", now.Format(time.RFC3339)) + + // Using math package + sqrtVal := math.Sqrt(16) + fmt.Printf("\nSquare root of 16 is: %.2f\n", sqrtVal) + + // Anonymous function + add := func(a, b int) int { + return a + b + } + fmt.Printf("\nSum of 10 and 20 is: %d\n", add(10, 20)) + + // Working with slices + numbers := []int{1, 2, 3, 4, 5} + fmt.Println("\nNumbers slice:") + for _, num := range numbers { + fmt.Printf("%d ", num) + } + fmt.Println() + + // Map example + personMap := map[string]Person{ + "p1": pers1, + "p2": pers2, + } + fmt.Println("\nPerson Map:") + for key, person := range personMap { + fmt.Printf("%s: %s, Age %d\n", key, person.Name, person.Age) + } } diff --git a/experiments/html.html b/experiments/html.html index bda2420..25a5147 100644 --- a/experiments/html.html +++ b/experiments/html.html @@ -3,8 +3,12 @@ - Document + + + + Sample Document +