diff --git a/Bash/README.md b/Bash/README.md new file mode 100644 index 0000000..539de76 --- /dev/null +++ b/Bash/README.md @@ -0,0 +1,23 @@ +# Bash Directory + +This directory contains code examples written in Bash. Bash is a Unix shell and command language that is widely used for scripting and automation. + +## Code Examples + +### 1. Hello World + +The `hello-world.sh` script prints "Hello, World!" to the console. + +```bash +# Hello World in Bash + +echo "Hello, World!" +``` + +## Contributing + +If you would like to contribute to this directory, please follow the guidelines outlined in the `CONTRIBUTING.md` file in the root directory of this repository. + +## License + +This directory is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same license. diff --git a/C#/README.md b/C#/README.md new file mode 100644 index 0000000..2d0a3cf --- /dev/null +++ b/C#/README.md @@ -0,0 +1,22 @@ +# C# Directory + +This directory contains C# programs. Below is a brief description of each file: + +## Files + +- `hello-world.cs`: A simple "Hello, World!" program in C#. + +## How to Compile and Run + +To compile and run any of the C# programs, use the following commands: + +```sh +csc filename.cs +mono filename.exe +``` + +Replace `filename.cs` with the name of the C# file you want to compile. + +## Contribution Guidelines + +Feel free to add more C# programs to this directory. Make sure to update this `README.md` file with a brief description of the new programs you add. diff --git a/C++/README.md b/C++/README.md new file mode 100644 index 0000000..b79209c --- /dev/null +++ b/C++/README.md @@ -0,0 +1,26 @@ +# C++ Directory + +This directory contains C++ code examples and algorithms. Each file demonstrates a specific concept or algorithm in C++. + +## List of Files + +- `binarySearch.cpp`: Implementation of binary search algorithm. +- `CP-template.cpp`: A template for competitive programming in C++. +- `hello-world.cpp`: A simple "Hello, World!" program in C++. +- `primes.cpp`: Program to calculate prime numbers in a given range. +- `segmentTreeForSum.cpp`: Implementation of a segment tree for sum queries. + +## How to Run the Code + +To compile and run any of the C++ programs, use the following commands: + +```bash +g++ -o output filename.cpp +./output +``` + +Replace `filename.cpp` with the name of the file you want to compile and run. + +## Contributing + +If you have any C++ code examples or algorithms that you would like to add to this directory, please follow the contribution guidelines in the main `README.md` file. diff --git a/C/README.md b/C/README.md new file mode 100644 index 0000000..6b8702d --- /dev/null +++ b/C/README.md @@ -0,0 +1,25 @@ +# C Directory + +This directory contains C programs. Below is a brief description of each file: + +## Files + +- `bubblesort.c`: Implementation of the Bubble Sort algorithm. +- `checkPrime.c`: Program to check for prime numbers. +- `hello-world.c`: A simple "Hello, World!" program in C. +- `insertionSort.c`: Implementation of the Insertion Sort algorithm. + +## How to Compile and Run + +To compile and run any of the C programs, use the following commands: + +```sh +gcc filename.c -o outputfile +./outputfile +``` + +Replace `filename.c` with the name of the C file you want to compile, and `outputfile` with the desired name of the executable. + +## Contribution Guidelines + +Feel free to add more C programs to this directory. Make sure to update this `README.md` file with a brief description of the new programs you add. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 647b788..5ea1263 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ Enhancement suggestions can be submitted as issues. Include: 2. Write clear commit messages. 3. Add test cases for any new functionality, if applicable. 4. Push your branch to GitHub: -5. + ```bash git push origin feature/your-feature-name diff --git a/Dart/README.md b/Dart/README.md new file mode 100644 index 0000000..43f402a --- /dev/null +++ b/Dart/README.md @@ -0,0 +1,23 @@ +# Dart Directory + +This directory contains code examples written in Dart. Dart is a client-optimized language for fast apps on any platform. + +## Code Examples + +### 1. Hello World + +The `hello-world.dart` script prints "Hello, World!" to the console. + +```dart +void main() { + print('Hello, World!'); +} +``` + +## Contributing + +If you would like to contribute to this directory, please follow the guidelines outlined in the `CONTRIBUTING.md` file in the root directory of this repository. + +## License + +This directory is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same license. diff --git a/Fortran/README.md b/Fortran/README.md new file mode 100644 index 0000000..fc315e6 --- /dev/null +++ b/Fortran/README.md @@ -0,0 +1,22 @@ +# Fortran Directory + +This directory contains Fortran programs. Below is a brief description of each file: + +## Files + +- `hello-world.f`: A simple "Hello, World!" program in Fortran. + +## How to Compile and Run + +To compile and run any of the Fortran programs, use the following commands: + +```sh +gfortran filename.f -o outputfile +./outputfile +``` + +Replace `filename.f` with the name of the Fortran file you want to compile, and `outputfile` with the desired name of the executable. + +## Contribution Guidelines + +Feel free to add more Fortran programs to this directory. Make sure to update this `README.md` file with a brief description of the new programs you add. diff --git a/Java/README.md b/Java/README.md new file mode 100644 index 0000000..72357c3 --- /dev/null +++ b/Java/README.md @@ -0,0 +1,37 @@ +# Java Directory + +This directory contains Java programs demonstrating various algorithms and data structures. Each file is a self-contained example of a specific algorithm or data structure. + +## List of Programs + +1. `BinarySearch.java`: Implementation of the binary search algorithm. +2. `BubbleSort.java`: Implementation of the bubble sort algorithm. +3. `HelloWorld.java`: A simple program that prints "Hello World!". +4. `insertionSort.java`: Implementation of the insertion sort algorithm. +5. `InterpolationSearch.java`: Implementation of the interpolation search algorithm. + +## How to Run + +To run any of the Java programs in this directory, follow these steps: + +1. Open a terminal or command prompt. +2. Navigate to the directory containing the Java file you want to run. +3. Compile the Java file using the `javac` command. For example, to compile `HelloWorld.java`, run: + ```bash + javac HelloWorld.java + ``` +4. Run the compiled Java program using the `java` command. For example, to run `HelloWorld`, run: + ```bash + java HelloWorld + ``` + +## Contribution Guidelines + +If you would like to contribute to this directory, please follow these guidelines: + +1. Ensure your code is well-documented and follows the coding standards. +2. Add a brief description of your program in this `README.md` file. +3. Ensure your program is placed in the correct directory. +4. Test your program thoroughly before submitting a pull request. + +Thank you for your contributions! diff --git a/Java/rotate 90 b/Java/Rotate90.java similarity index 96% rename from Java/rotate 90 rename to Java/Rotate90.java index 8668532..e85f471 100644 --- a/Java/rotate 90 +++ b/Java/Rotate90.java @@ -1,4 +1,4 @@ -public class Solution { +public class Rotate90 { public void solve(int[][] A) { int temp = 0; for(int i = 0; i { + console.log(message); + }; + const debouncedLog = debounce(logMessage, 300); + debouncedLog('Hello'); + debouncedLog('World'); + debouncedLog('!'); + ``` + +### `Throttle.js` +- **Description**: A throttle function in JavaScript limits how often a given function can be called in a given time period. This is particularly useful when handling events like scroll or resize, where frequent firing can impact performance. +- **Usage**: The `throttle` function takes two arguments: the function to throttle and the limit in milliseconds. It returns a throttled version of the function. +- **Example**: + ```javascript + const logMessage = (message) => { + console.log(message); + }; + const throttledLog = throttle(logMessage, 1000); + throttledLog('Hello'); + throttledLog('World'); + throttledLog('!'); + ``` + +### `hello-world.js` +- **Description**: A simple "Hello, World!" program in JavaScript. +- **Usage**: Run the file using a JavaScript runtime like Node.js. +- **Example**: + ```javascript + console.log("Hello, World!"); + ``` + +## Contributing + +If you have any JavaScript code examples or utilities that you would like to add to this directory, please follow the contribution guidelines in the main `README.md` file of the repository. diff --git a/Kotlin/README.md b/Kotlin/README.md new file mode 100644 index 0000000..5aa15f2 --- /dev/null +++ b/Kotlin/README.md @@ -0,0 +1,33 @@ +# Kotlin Directory + +This directory contains Kotlin code examples and exercises. Each file demonstrates a specific concept or functionality in Kotlin. + +## Files + +- `hello-world.kt`: A simple "Hello, World!" program in Kotlin. + +## How to Run + +To run the Kotlin programs in this directory, you need to have Kotlin installed on your machine. You can download and install Kotlin from the official [Kotlin website](https://kotlinlang.org/). + +Once Kotlin is installed, you can run the programs using the following command: + +```bash +kotlinc .kt -include-runtime -d .jar +java -jar .jar +``` + +Replace `` with the name of the Kotlin file you want to run and `` with the desired name for the output JAR file. + +## Contributing + +If you have any Kotlin code examples or exercises that you would like to add to this directory, please follow the steps below: + +1. Fork the repository. +2. Create a new branch for your changes. +3. Add your Kotlin code to this directory. +4. Update this `README.md` file to include a description of your code. +5. Commit your changes and push them to your forked repository. +6. Create a pull request to the main repository. + +We appreciate your contributions! diff --git a/PHP/README.md b/PHP/README.md new file mode 100644 index 0000000..8ede4fb --- /dev/null +++ b/PHP/README.md @@ -0,0 +1,12 @@ +# PHP Directory + +This directory contains PHP code examples. Below is a brief description of each file in this directory. + +## Files + +### hello-world.php +A simple PHP script that prints "Hello, World!" to the screen. + +## Contributing + +If you would like to contribute to this directory, please follow the guidelines in the main `CONTRIBUTING.md` file located in the root directory of this repository. Make sure to add a brief description of your PHP script in this `README.md` file. diff --git a/Perl/README.md b/Perl/README.md new file mode 100644 index 0000000..94609cc --- /dev/null +++ b/Perl/README.md @@ -0,0 +1,11 @@ +# Perl Directory + +This directory contains Perl scripts and programs. Below is a brief description of the code in this directory. + +## hello-world.pl + +This script prints "Hello, World!" to the console. It is a simple example to demonstrate the basic syntax of Perl. + +## Contributing + +If you would like to contribute to this directory, please follow the guidelines in the main `CONTRIBUTING.md` file. Ensure that your code is well-documented and adheres to the coding standards of the repository. diff --git a/Python/README.md b/Python/README.md new file mode 100644 index 0000000..3cb3a36 --- /dev/null +++ b/Python/README.md @@ -0,0 +1,65 @@ +# Python Code Examples + +This directory contains code examples written in Python. Each example demonstrates a specific concept or functionality in Python programming. + +## Table of Contents + +1. [Hello World](#hello-world) +2. [Caesar Cipher Encrypt](#caesar-cipher-encrypt) +3. [Caesar Cipher Decrypt](#caesar-cipher-decrypt) + +## Hello World + +The "Hello World" program is a simple program that prints "Hello, World!" to the console. It is often used as the first program when learning a new programming language. + +```python +# Program to print Hello World + +print("Hello World!") +``` + +## Caesar Cipher Encrypt + +The Caesar Cipher is a simple encryption technique where each letter in the plaintext is shifted a certain number of places down the alphabet. The following code demonstrates how to encrypt a message using the Caesar Cipher. + +```python +def caesar_cipher(text, key): + result = "" + for char in text: + if char.isupper(): + result += chr((ord(char) + key - 65) % 26 + 65) + elif char.islower(): + result += chr((ord(char) + key - 97) % 26 + 97) + else: + result += char + + return result +text = input("Enter the string to encode: ") +key = int(input("Enter the shift key: ")) + +encoded_text = caesar_cipher(text, key) +print(f"Encoded string: {encoded_text}") +``` + +## Caesar Cipher Decrypt + +The Caesar Cipher decryption is the reverse process of the encryption. It shifts each letter in the ciphertext back by the same number of places to get the original plaintext. The following code demonstrates how to decrypt a message using the Caesar Cipher. + +```python +def caesar_decrypt(text, key): + result = "" + for char in text: + if char.isupper(): + result += chr((ord(char) - key - 65) % 26 + 65) + elif char.islower(): + result += chr((ord(char) - key - 97) % 26 + 97) + else: + result += char + return result + +text = input("Enter the encoded string: ") +key = int(input("Enter the shift key: ")) + +decoded_text = caesar_decrypt(text, key) +print(f"Decoded string: {decoded_text}") +``` diff --git a/R/README.md b/R/README.md new file mode 100644 index 0000000..7611889 --- /dev/null +++ b/R/README.md @@ -0,0 +1,23 @@ +# R Directory + +This directory contains code examples written in R. R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing. + +## Code Examples + +### 1. Hello World + +The `hello-world.r` script prints "Hello, World!" to the console. + +```r +# Hello World in R + +print("Hello, World!") +``` + +## Contributing + +If you would like to contribute to this directory, please follow the guidelines outlined in the `CONTRIBUTING.md` file in the root directory of this repository. + +## License + +This directory is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same license. diff --git a/README.md b/README.md index ea1f74c..937ae44 100644 --- a/README.md +++ b/README.md @@ -170,3 +170,68 @@ You should navigate to your forked repository, and press the “New pull request Every pull request is accepted and merged. So hurry up and contribute to this repo. # Hurray!! You just got closer to complete your hacktoberfest challenge. + +## Purpose of the Repository + +The purpose of this repository is to provide a platform for developers to contribute to open-source projects during Hacktoberfest and Hacksquad 2024. By adding a 'Hello World' program in any programming language, contributors can participate in these events, learn about different programming languages, and collaborate with the community. + +## How to Contribute + +1. **Fork the repository** to your own GitHub account. +2. **Clone your forked repository** to your local machine: + + ```bash + git clone https://github.com/your-username/Code-Contribution.git + ``` + +3. **Create a new branch** for your contribution: + + ```bash + git checkout -b feature/your-feature-name + ``` + +4. **Add your 'Hello World' program** in the appropriate language directory. If the directory does not exist, create one. + +5. **Commit your changes** with a descriptive commit message: + + ```bash + git commit -m "Add Hello World in [Language]" + ``` + +6. **Push your branch** to your forked repository: + + ```bash + git push origin feature/your-feature-name + ``` + +7. **Open a Pull Request** to the main branch of this repository with a descriptive title and summary of your changes. + +8. **Wait for review and approval**. Once your pull request is approved, it will be merged into the main branch. + +### Example Contributions + +Here are some examples of 'Hello World' programs in different programming languages: + +#### Python + +```python +print("Hello, World!") +``` + +#### JavaScript + +```javascript +console.log("Hello, World!"); +``` + +#### C++ + +```cpp +#include +int main() { + std::cout << "Hello, World!" << std::endl; + return 0; +} +``` + +Feel free to explore the repository and see more examples in various languages. Happy contributing! diff --git a/Ruby/README.md b/Ruby/README.md new file mode 100644 index 0000000..0428362 --- /dev/null +++ b/Ruby/README.md @@ -0,0 +1,21 @@ +# Ruby Directory + +This directory contains Ruby programs. Below is a brief description of each file: + +## Files + +- `hello-world.rb`: A simple "Hello, World!" program in Ruby. + +## How to Run + +To run any of the Ruby programs, use the following command: + +```sh +ruby filename.rb +``` + +Replace `filename.rb` with the name of the Ruby file you want to run. + +## Contribution Guidelines + +Feel free to add more Ruby programs to this directory. Make sure to update this `README.md` file with a brief description of the new programs you add. diff --git a/Rust/README.md b/Rust/README.md new file mode 100644 index 0000000..2d4c2eb --- /dev/null +++ b/Rust/README.md @@ -0,0 +1,24 @@ +# Rust Directory + +This directory contains code examples written in Rust. The purpose of these examples is to provide a reference for developers who are learning Rust or looking for solutions to common programming problems. + +## Code Examples + +### Hello World + +The `hello-world.rs` file contains a simple "Hello, World!" program in Rust. + +```rust +//A Simple Hello World Program +fn main() { + println!("Hello World!"); +} +``` + +## Contributing + +If you would like to contribute to this directory, please follow the guidelines outlined in the `CONTRIBUTING.md` file in the root of the repository. Make sure to add detailed comments and documentation to your code to help others understand it. + +## License + +This directory is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same license. diff --git a/Scala/README.md b/Scala/README.md new file mode 100644 index 0000000..570d483 --- /dev/null +++ b/Scala/README.md @@ -0,0 +1,22 @@ +# Scala Directory + +This directory contains Scala programs. Below is a brief description of each file: + +## Files + +- `hello-world.scala`: A simple "Hello, World!" program in Scala. + +## How to Compile and Run + +To compile and run any of the Scala programs, use the following commands: + +```sh +scalac filename.scala +scala filename +``` + +Replace `filename.scala` with the name of the Scala file you want to compile. + +## Contribution Guidelines + +Feel free to add more Scala programs to this directory. Make sure to update this `README.md` file with a brief description of the new programs you add. diff --git a/Swift/README.md b/Swift/README.md new file mode 100644 index 0000000..7dcd419 --- /dev/null +++ b/Swift/README.md @@ -0,0 +1,11 @@ +# Swift Directory + +This directory contains Swift code examples. Each example is designed to demonstrate a specific concept or feature of the Swift programming language. + +## Hello World + +The `hello-world.swift` file contains a simple "Hello, World!" program in Swift. This is a basic example to get you started with Swift. + +## Contributing + +If you have any Swift code examples that you would like to add, please follow the guidelines in the main `CONTRIBUTING.md` file. Make sure to add a brief description of your code in this `README.md` file. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..1902018 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,103 @@ +# Documentation + +Welcome to the documentation section of the Code-Contribution repository. This section provides detailed information and examples to help you understand and contribute to the project effectively. + +## Table of Contents + +1. [Introduction](#introduction) +2. [Getting Started](#getting-started) +3. [Code Examples](#code-examples) +4. [Contribution Guidelines](#contribution-guidelines) +5. [FAQs](#faqs) + +## Introduction + +The Code-Contribution repository is a collaborative project aimed at showcasing simple code examples in various programming languages. The goal is to provide a platform for developers to contribute and learn from each other by adding and reviewing code snippets. + +## Getting Started + +To get started with contributing to the Code-Contribution repository, follow these steps: + +1. **Fork the repository** to your own GitHub account. +2. **Clone your forked repository** to your local machine: + + ```bash + git clone https://github.com/your-username/Code-Contribution.git + ``` + +3. **Create a new branch** for your contribution: + + ```bash + git checkout -b feature/your-feature-name + ``` + +4. **Add your code example** in the appropriate language directory. If the directory does not exist, create one. + +5. **Commit your changes** with a descriptive commit message: + + ```bash + git commit -m "Add [Language] code example" + ``` + +6. **Push your branch** to your forked repository: + + ```bash + git push origin feature/your-feature-name + ``` + +7. **Open a Pull Request** to the main branch of this repository with a descriptive title and summary of your changes. + +## Code Examples + +Here are some examples of code snippets in various programming languages: + +### Python + +```python +print("Hello, World!") +``` + +### JavaScript + +```javascript +console.log("Hello, World!"); +``` + +### C++ + +```cpp +#include +int main() { + std::cout << "Hello, World!" << std::endl; + return 0; +} +``` + +## Contribution Guidelines + +To ensure a smooth contribution process, please follow these guidelines: + +- **Code Style:** Follow consistent and readable code conventions. +- **Documentation:** Document your code where necessary. +- **Tests:** Run existing tests and add tests for new features. +- **Commit Messages:** Write clear and descriptive commit messages. + +## FAQs + +### How do I fork the repository? + +To fork the repository, click the "Fork" button at the top right corner of the repository page on GitHub. This will create a copy of the repository in your own GitHub account. + +### How do I create a new branch? + +To create a new branch, use the `git checkout -b` command followed by the name of your branch. For example: + +```bash +git checkout -b feature/your-feature-name +``` + +### How do I open a Pull Request? + +To open a Pull Request, navigate to your forked repository on GitHub, click the "New pull request" button, and provide a descriptive title and summary of your changes. + +For more detailed instructions, refer to the main `README.md` file in the root directory of this repository.