Skip to content

Commit

Permalink
Merge branch 'master' into Visual-Basic-Bubble-Sort
Browse files Browse the repository at this point in the history
  • Loading branch information
jrg94 authored Oct 2, 2020
2 parents 63eceef + 91ea91c commit 8cf1a46
Show file tree
Hide file tree
Showing 29 changed files with 473 additions and 41 deletions.
6 changes: 3 additions & 3 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as contributo

## Our Standards

Examples of behavior that contributes to creating a positive environment include:
Examples of behavior that contribute to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
Expand All @@ -16,7 +16,7 @@ Examples of behavior that contributes to creating a positive environment include

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Using sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
Expand All @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at jeremy.grifski@therenegadecoder.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at jeremy.grifski@therenegadecoder.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team must maintain confidentiality regarding the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Expand Down
50 changes: 25 additions & 25 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ links to language references and a list of fun facts.
The testinfo.yml provides information about the projects in the folder
to our testing library.

Naturally, if you wish to add a completely new language to the repository, you'll
need to follow this repository structure.
Naturally, if you wish to add a completely new language to the repository, you must
follow this repository structure.

### Test

Meanwhile, the test folder contains all of the testing related files. Tests are
Meanwhile, the test folder contains all the testing related files. Tests are
organized by project and administered through Glotter. This toolkit allows us
to write blackbox tests in Python for any programming language.
to write black-box tests in Python for any programming language.

To see what projects are already covered, take a peek in the projects folder.
There, you'll find each test file which contains the set of valid and invalid
tests.

To create your own tests, you'll need to either modify the existing test files
To create your own tests, you must either modify the existing test files
or create a new one for a new project. Keep in mind that tests must be written
according to the [project documentation][44].

Expand All @@ -70,7 +70,7 @@ using lowercase alphanumeric character sequences separated by dashes only.
If we do not adhere to this rule, we risk limiting contributors by platform.

For example, let's say someone adds C\* to our repository. If we name the directory
c\*, then Windows users will be unable to clone the repository. Instead, consider
c\*, then Windows users cannot clone the repository. Instead, consider
using c-star. The following table shares a few examples:

| Language | Proper Directory Name |
Expand All @@ -84,8 +84,8 @@ Thanks for keeping this repository inclusive!

### Source Files

Each source file must be named using the file name specified in the project description.
However, the naming convention for the filename (capitalization, hyphenation, etc...)
Each source file must be named using the filename specified in the project description.
However, the naming convention for the filename (capitalization, hyphenation, etc.)
should follow the industry standard for each language. If you are unsure of the naming
convention for a given language, check the `testinfo.yaml` file found in the language directory.

Expand Down Expand Up @@ -116,7 +116,7 @@ We'll break these down in the following sections.

Naturally, this repo contains a lot of code snippets. If you find any that are
missing, you're free to add them. However, we are strict in the types of code
snippets you can add. If you're looking for the most up to date list of code snippets,
snippets you can add. If you're looking for the most up-to-date list of code snippets,
check out the [projects page][44]. All snippets must adhere to the requirements outlined
in their project page. If there's a code snippet you'd like to include that doesn't
currently exist in the list of projects, head over to the [documentation repo][47] to
Expand All @@ -131,19 +131,19 @@ For instance, let's say you find that the Python collection is missing both
Hello World and Fibonacci, and you'd like to add them both. It would be to
your advantage to then fork the repo and make a branch for each program.

On your Hello World branch, you should add your sample program and update the
Python README to reflect the change. Then, you should make a pull request.
On your Hello World branch, add your sample program and update the
Python README to reflect the change. Then make a pull request.
Because you've made a branch, you won't have to wait for us to approve the change.
You can quickly jump back to master and create a new branch for your next
program.

In this scenario, there will likely be a merge conflict that we can easily
In this scenario, there will probably be a merge conflict that we can easily
resolve when you make your pull request. This is the ideal workflow for this
repo.

#### Create READMEs for New Languages

Ocassionally, there will be times when you may want to add a new language to the repo.
Occasionally, there will be times when you may want to add a new language to the repo.
When adding new languages, make sure you include a README using the following template:

```markdown
Expand All @@ -166,8 +166,8 @@ Welcome to Sample Programs in [Insert Language Here]!

In the section labeled `[Insert List of Sample Program Additions Here]`, please
add the name of the sample program you've added. Ideally, you would link to the
article here. At this point, however, the article doesn't exist. Instead, you
should create an issue for the article and link the issue here.
article here. At this point, however, the article doesn't exist. Instead, create
an issue for the article and link the issue here.

In addition, in the section labeled `[Insert List of Fun Facts Here]`, please
add fun information like when the language debuted, who develops the language,
Expand All @@ -184,20 +184,20 @@ README. Every time a unique language syntax appears in the repo for a particular
language, we track it in its README with links. Check out the [Python README][13]
for an example.

Don't worry if you forget any of this; we have a check list of reminders in the
Don't worry if you forget any of this; we have a checklist of reminders in the
pull request template. At any rate, let's have some fun!

### Tests

All tests are automatically run as part of the build process for this project.
Running all tests does take some time due to the nature of the project.
Running all tests takes some time due to the project.
When making a pull request, please ensure all tests passed in travis.
We cannot merge any pull requests with failing tests.

#### Writing Testable Code

Since this project is basically just a large collection of related, but isolated files,
we have decided to automate testing using predefined test cases as input and checking for expected output.
Since this project is basically just an enormous collection of related, but isolated files,
we have decided to automate testing using pre-defined test cases as input and checking for expected output.
All programs that require input should take that input as command line arguments.
They should then print the output of the program to the console.
**Each program should print the expected result of the program with no other output.**
Expand All @@ -207,16 +207,16 @@ refer to "Testing" section of each [project documentation][44].
Each project has a table containing a short name for the test,
the input that will be used for the test and the expected output.

Next make sure to follow the naming conventions specified in the [Naming Conventions][2] section above.
Next, follow the naming conventions specified in the [Naming Conventions][2] section above.
To see the naming conventions for projects that have existing tests refer to the "words"
list in the [.glotter.yml][46] and to the `testinfo.yml` file in the language folder.

#### Running Tests Locally

In order to run the tests locally, **you will need the following dependencies**:
To run the tests locally, **you will need the following dependencies**:

- Docker
- As there are so many languages contained in this project, we use docker to automatically generate
- As there are so many languages in this project, we use docker to automatically generate
consistent, stable build/test environments.
- Python 3.7+
- We use glotter as our testing library. Make sure you have python installed.
Expand All @@ -242,16 +242,16 @@ Some common cases for testing are outlined below.
#### Writing Tests

Currently, @auroq handles most of the test writing. However, if you would like to contribute your own
test files, get in touch with him. Alternatively, you can use the existing examples to try to write
test files, get in touch with him. Alternatively, you can use the existing examples to write
your own tests. Be aware that writing tests is a huge process that may or may not result in the
modification of many existing files.

## Plagiarism

**Please** do not submit work that is copied from another source. If work is found to be
plagiarized, the issue must be remedied ASAP. The quickest solution is to cite the source--a citation
plagiarized, the issue must be remedied ASAP. The quickest solution is to cite the sourcea citation
in the README would suffice. After that, the solution should be adapted as needed. If necessary, the
solution will be removed at the authors request.
solution will be removed at the author's request.

Whenever possible, **please** request the original author to share their solution with this repo. This
keeps the repo tidy by eliminating the need for citations.
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Find which section best describes your pull request and make sure you fill it ou
- [ ] I named the pull request using `Added/Updated <Sample Program> in <Language>` format
- [ ] I created/updated the language README
- [ ] I added the sample program name to the README
- [ ] I added fun facts (i.e. debut, developer, typing, etc.)
- [ ] I added fun facts (i.e. debut developer, typing, etc.)
- [ ] I added reference link(s) to the README
- [ ] I added solution citations when necessary (see [plagiarism][2])

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ __pycache__/
.scratch
# erlang
*.beam

.DS_Store
1 change: 1 addition & 0 deletions archive/a/autohotkey/hello-world.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MsgBox, 0x30, Sample Programs, Hello, World!
16 changes: 16 additions & 0 deletions archive/f/fortran/fizz-buzz.f95
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
program fizz_buzz
integer :: i

do i = 1,100
if ((modulo(i,3) == 0) .and. (modulo(i,5) == 0)) then
write (*,'(a)') "FizzBuzz"
else if (modulo(i,3) == 0) then
write (*,'(a)') "Fizz"
else if (modulo(i,5) == 0) then
write (*,'(a)') "Buzz"
else
write (*,'(I0)') i
end if
end do

end program fizz_buzz
4 changes: 2 additions & 2 deletions archive/j/java/HelloWorld.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
System.out.println("Hello, World!");
}
}
}
12 changes: 4 additions & 8 deletions archive/j/java/InsertionSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,11 @@ public static void insertionSort(ArrayList<Integer> numList) {
numList.set(k+1, val);
}
//display the sorted list to the user
String str="";
for(int i=0;i<numList.size()-1;i++) {
str+=String.valueOf(numList.get(i));
str+=", ";
for(int i=0; i < numList.size() - 1; i++) {
System.out.print(numList.get(i) + ", ");
}
str+=String.valueOf(numList.get(numList.size()-1));
System.out.println(str);
System.out.print(numList.get(numList.size() - 1));

}

}


1 change: 1 addition & 0 deletions archive/j/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Welcome to Sample Programs in Java!
- Debut: 1995
- Developer: Sun Microsystems -> Oracle Corporation
- Typing: Static
- Paradigm: object oriented

## References

Expand Down
1 change: 1 addition & 0 deletions archive/j/javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Welcome to Sample Programs in JavaScript!
- [Hello World in JavaScript][2]
- [Insertion sort in JavaScript][16]
- [Import in JavaScript][13]
- Linear Search in JavaScript
- [Prime Number in JavaScript][14]
- [Reverse a String in JavaScript (No Emoji Support)][3]
- [Roman Numeral Conversion in JavaScript][17]
Expand Down
21 changes: 21 additions & 0 deletions archive/j/javascript/linear-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Author : Nameer Waqas
Date: 01/10/2020
Title: Implementation of Linear search algorithm in JS
Algorithm Big-O = O(n)
*/

function LinSearch(arr = [], valToSearch) {
let check = false;
if (arr.length == 0) return check
if(valToSearch==='') return check
else {
for (i = 0; i < arr.length; i++) {
if (arr[i] == valToSearch){
check = true
return check
}
}
return check
}
}
24 changes: 24 additions & 0 deletions archive/j/julia/factorial.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/julia

function err()
println("Usage: please input a non-negative integer")
end

function fac(n)
if n < 0
err()
exit()
end

out = 1
for i = 1:n
out = out * i
end
return out
end

try
println(fac(parse(Int, ARGS[1])))
catch e
err()
end
52 changes: 52 additions & 0 deletions archive/j/julia/selection-sort.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/julia

function SelectionSort(arr)
l = length(arr)
sorted_list = []
for i = 1:l
m = minimum(arr)
push!(sorted_list,m)
deleteat!(arr, findfirst(x->x==m,arr))
end
return sorted_list
end

function error()
println("Usage: please provide a list of at least two integers to sort in the format \"1, 2, 3, 4, 5\"")
end

function HandleInput(inp)

a = split(inp,",")
a = map(x->split(x," "),a)
a = map(x->last(x),a)
numbers = map(x->parse(Int,x),a)
if length(numbers) == 1
error()
exit()
end
return numbers

end

function PrintOutput(out)
for i = 1:length(out)
print(out[i])
if i != length(out)
print(", ")
end
end
println()
end

try

n = HandleInput(ARGS[1])
sorted = SelectionSort(n)
PrintOutput(sorted)

catch e
error()
end


Loading

0 comments on commit 8cf1a46

Please sign in to comment.