generated from GauravWalia19/mernboilerplate
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added readme, contributing file and other codes
- Loading branch information
1 parent
aa07c45
commit 215f175
Showing
5 changed files
with
228 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# CONTRIBUTING GUIDELINES | ||
|
||
Before contributing to this project make sure you star this repository. We really need support from you guys. | ||
|
||
## GUIDELINES | ||
|
||
* For contributing firstly fork this repository. | ||
* After that you can create your new branch in your repository for contributing. | ||
* You are welcome to add good quality codes in **CodeBase directory**. Make sure you follow the below format and your filename should be unique in CodeBase folder. Other changes in the project are not allowed right now. | ||
* Hurry Up send us a good quality Pull Request. 1 PR -> 1 Good Quality Code. | ||
|
||
### C / C++ / JAVA / JS | ||
|
||
```c | ||
/** | ||
* PROBLEM: <PROBLEM STATEMENT> | ||
* AUTHOR: <GITHUB USERNAME> | ||
**/ | ||
good quality code | ||
``` | ||
|
||
Please have a look at [LinearSearch.c](CodeBase/LinearSearch.c) and [SelectionSort.java](CodeBase/SelectionSort.java) | ||
|
||
### PYTHON | ||
|
||
```python | ||
|
||
# PROBLEM: <PROBLEM STATEMENT> | ||
# AUTHOR: <GITHUB USERNAME> | ||
good quality code | ||
``` | ||
|
||
### Request other language | ||
|
||
You can request other languages by creating a issue on the repository via **Request Language Issue Template**. | ||
|
||
## DON'T | ||
|
||
* Please don't copy the code from the internet Plagiarism will be checked before we merge the code. | ||
* Strict Action will be taken against the person for copying the idea. | ||
* Please follow the guidelines before contributing otherwise it will be marked as invalid. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* PROBLEM: Linear Search in C language | ||
* AUTHOR: GauravWalia19 | ||
**/ | ||
#include <stdio.h> | ||
#include <stdbool.h> | ||
|
||
void linearsearch(int*, int, int); | ||
|
||
int main(){ | ||
int size; | ||
int findElement; | ||
|
||
printf("Enter the size of the array\n"); | ||
scanf("%d",&size); | ||
|
||
int array[size]; | ||
register int i; | ||
|
||
for(i=0; i<size; i++){ | ||
scanf("%d", &array[i]); | ||
} | ||
|
||
printf("Enter the element to search in the array\n"); | ||
scanf("%d", &findElement); | ||
|
||
linearSearch(array, size, findElement); | ||
} | ||
|
||
/** | ||
* this function contains the core logic for linear search algorithm | ||
* | ||
* @param array | ||
* @param size | ||
* @param findElement | ||
* | ||
* @return void | ||
**/ | ||
void linearSearch(int *array, int size, int findElement){ | ||
register int i; | ||
bool flag = false; | ||
|
||
for(i=0; i<size; i++){ | ||
if(findElement == array[i]){ | ||
flag = true; | ||
break; | ||
} | ||
} | ||
|
||
if(flag){ | ||
printf("Element found\n"); | ||
}else{ | ||
printf("No element found\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* PROBLEM: Selection sort in java | ||
* AUTHOR: GauravWalia19 | ||
**/ | ||
import java.util.*; | ||
|
||
public class SelectionSort | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
Scanner in = new Scanner(System.in); //scanner for input | ||
int n; //size of the array | ||
System.out.println("Enter the size of the array"); | ||
n = in.nextInt(); | ||
int[] arr = new int[n]; //declared array | ||
System.out.println("Enter the elements"); | ||
for(int i=0;i<n;i++) //input array | ||
{ | ||
arr[i] = in.nextInt(); | ||
} | ||
selectionsort(arr); | ||
in.close(); | ||
for(int k=0;k<arr.length;k++) | ||
{ | ||
System.out.print(arr[k]+" "); | ||
} | ||
System.out.println(); | ||
} | ||
public static void selectionsort(int[] array) | ||
{ | ||
int i,j; | ||
int max=0; //maximum index | ||
for(i=array.length-1;i>0;i--) | ||
{ | ||
max=0; | ||
for(j=0;j<=i;j++) //finding max index in the elements | ||
{ | ||
if(array[max] < array[j]) | ||
{ | ||
max = j; | ||
} | ||
} | ||
swap(array,max,i); | ||
} | ||
} | ||
public static void swap(int[] arr,int a,int b) | ||
{ | ||
//swapping | ||
int t = arr[a]; | ||
arr[a] = arr[b]; | ||
arr[b] = t; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,19 @@ | ||
# MERN BOILERPLATE | ||
# HACKTOBER FEST COMMUNITY 2020 | ||
|
||
This is a boilerplate repo for creating new mern stack apps that doesn't sucks. | ||
This project is to teach you programmers how to write better quality code which is not written by the programmers working at the companies. We accept the codes that not suck. | ||
|
||
This is minimalist boilerplate for Full Stack MERN developers *(Recommended for beginners only)*. This boilerplate provides basic configurations like: | ||
## CONCEPT | ||
|
||
* Sample CRUD API | ||
* Create-react-app boilerplate | ||
* NPM Scripts needed for MERN Stack | ||
* Sample mongoose connection provided for connecting API with database like mongodb | ||
* Heroku Deployment Configurations | ||
Basically the concept of the project to rate the better quality amongst others. In this project the programmers can randomly rate the code of some other guys which is unknown and you can view your code quality rating which you got. For rating we are working on a website which you will get this October before the Hacktober Fest Ends. | ||
|
||
## Available Scripts | ||
## CODEBASE | ||
|
||
For APIs to work in development please add a **.env** file in root of the project and add your **MONGODB_URI** in that file. | ||
This is a community project so we need a support from you guys for having the better quality code snippets of some problem. Please refer to [Contributing Guidelines](CONTRIBUTING.md). | ||
|
||
### `yarn start` | ||
### HACKTOBER FEST 20 | ||
|
||
Runs the server in the production mode.<br /> | ||
Open [http://localhost:5000/api/v1/get](http://localhost:5000/api/v1/get) to view sample CRUD API output from server in the browser. | ||
As a part of the contest send us better quality code in any language written by you only. For more details please refer to [Contributing Guidelines](CONTRIBUTING.md). | ||
|
||
### `yarn run dev` | ||
## LICENSE | ||
|
||
Runs the server in the development mode.<br /> | ||
Open [http://localhost:5000/api/v1/get](http://localhost:5000/api/v1/get) to view sample CRUD API output from server in the browser. | ||
|
||
The server will auto restart if you make any changes. | ||
|
||
### `yarn run client` | ||
|
||
Runs the app in the development mode.<br /> | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.<br /> | ||
You will also see any lint errors in the console. | ||
|
||
### `yarn run mern` | ||
|
||
Runs the **server** and the **client** at the **same time** that makes MERN Stack development easier.<br> | ||
|
||
Open [http://localhost:5000/api/v1/get](http://localhost:5000/api/v1/get) to view sample CRUD API output from server in the browser.<br> | ||
|
||
Open [http://localhost:3000](http://localhost:3000) to view React App in the browser. | ||
|
||
## Steps for Heroku Deployment | ||
|
||
### Dependencies | ||
|
||
* nodejs | ||
* yarn package manager | ||
* heroku cli | ||
|
||
### Deployment Steps | ||
|
||
1. Check whether you have heroku installed in you PC or not using `heroku --version` command. If you don't have then you can install it from [here](https://devcenter.heroku.com/articles/heroku-cli). | ||
|
||
2. Create your account if you don't have any. | ||
|
||
3. Then open the terminal or cmd in root directory and make sure you have created a git repository for your project. Remove **.git** directory if present in **client** folder otherwise it may lead to deployment issues. | ||
|
||
4. **All the heroku build deployment scripts are provided you can review and update the engine in root package.json if you want to deploy with any other version of node and yarn** . | ||
|
||
5. Then login your heroku account using `heroku login`. | ||
|
||
6. After login its time to create a new app with you app name using `heroku create <your unique app name>`. If you get name already used then you have to choose any other unique name. | ||
|
||
7. Now open the heroku account in the browser, you will see your app is created. Then open the settings of the app and in the config vars add **heroku variables** like **MONGODB_URI**. | ||
|
||
8. For deployment run `git push heroku master` and it will deploy your app on heroku. | ||
[MIT LICENSE](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# MERN BOILERPLATE | ||
|
||
This is a boilerplate repo for creating new mern stack apps that doesn't sucks. | ||
|
||
This is minimalist boilerplate for Full Stack MERN developers *(Recommended for beginners only)*. This boilerplate provides basic configurations like: | ||
|
||
* Sample CRUD API | ||
* Create-react-app boilerplate | ||
* NPM Scripts needed for MERN Stack | ||
* Sample mongoose connection provided for connecting API with database like mongodb | ||
* Heroku Deployment Configurations | ||
|
||
## Available Scripts | ||
|
||
For APIs to work in development please add a **.env** file in root of the project and add your **MONGODB_URI** in that file. | ||
|
||
### `yarn start` | ||
|
||
Runs the server in the production mode.<br /> | ||
Open [http://localhost:5000/api/v1/get](http://localhost:5000/api/v1/get) to view sample CRUD API output from server in the browser. | ||
|
||
### `yarn run dev` | ||
|
||
Runs the server in the development mode.<br /> | ||
Open [http://localhost:5000/api/v1/get](http://localhost:5000/api/v1/get) to view sample CRUD API output from server in the browser. | ||
|
||
The server will auto restart if you make any changes. | ||
|
||
### `yarn run client` | ||
|
||
Runs the app in the development mode.<br /> | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.<br /> | ||
You will also see any lint errors in the console. | ||
|
||
### `yarn run mern` | ||
|
||
Runs the **server** and the **client** at the **same time** that makes MERN Stack development easier.<br> | ||
|
||
Open [http://localhost:5000/api/v1/get](http://localhost:5000/api/v1/get) to view sample CRUD API output from server in the browser.<br> | ||
|
||
Open [http://localhost:3000](http://localhost:3000) to view React App in the browser. | ||
|
||
## Steps for Heroku Deployment | ||
|
||
### Dependencies | ||
|
||
* nodejs | ||
* yarn package manager | ||
* heroku cli | ||
|
||
### Deployment Steps | ||
|
||
1. Check whether you have heroku installed in you PC or not using `heroku --version` command. If you don't have then you can install it from [here](https://devcenter.heroku.com/articles/heroku-cli). | ||
|
||
2. Create your account if you don't have any. | ||
|
||
3. Then open the terminal or cmd in root directory and make sure you have created a git repository for your project. Remove **.git** directory if present in **client** folder otherwise it may lead to deployment issues. | ||
|
||
4. **All the heroku build deployment scripts are provided you can review and update the engine in root package.json if you want to deploy with any other version of node and yarn** . | ||
|
||
5. Then login your heroku account using `heroku login`. | ||
|
||
6. After login its time to create a new app with you app name using `heroku create <your unique app name>`. If you get name already used then you have to choose any other unique name. | ||
|
||
7. Now open the heroku account in the browser, you will see your app is created. Then open the settings of the app and in the config vars add **heroku variables** like **MONGODB_URI**. | ||
|
||
8. For deployment run `git push heroku master` and it will deploy your app on heroku. |