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
/** | |
Task 1: In the Vote box, add a downvote button to the right of Upvote. | |
Task 2: The number in the red box indicates the number of total vote received. It should be incremented by 1 when Upvote is pressed and decremented by 1 when downvote is pressed. | |
Task 3: Each button will remain in the pressed position after it is clicked. If it is clicked again, the vote will be canceled. For instance, if Upvote is clicked, then the total vote is 1, but if Upvote is clicked again, total vote becomes 0. Only one button can remain in the pressed position. For instance, if Upvote is pressed down and the vote is 1, when Downvote is clicked, Upvote will automatically bounce and Downvote will be pressed down. Total vote changes from 1 to -1. This guarantess that the vote can only have 3 possible values: -1, 0, and 1 | |
**/ | |
function Vote({ handleVotePress }) { | |
return ( | |
<> | |
<div>Vote</div> | |
<button onClick={handleVotePress(1)}>Upvote</button> |
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
fetch(BASE_URL, { | |
method: "POST", | |
headers | |
}) | |
.then(response => response.body) | |
.then(response => { | |
const reader = response.getReader(); | |
// read() returns a promise that resolves | |
// when a value has been received | |
reader |
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
job(projectName) { | |
scm { | |
git { | |
remote { | |
url(projectURL) | |
credentials('admin') | |
} | |
} | |
} | |
triggers { |
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
function createMainProject(request, response) { | |
newProject(data) | |
.then(res => { | |
return addMememberToProject(project, user); | |
}) | |
.then(res => { | |
return createWebhook(projectName, res.projectId); | |
}) | |
.then(res => { | |
return runJenkins(projectName, port) |
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
import java.util.*; | |
public class test { | |
public static void main(String[] args){ | |
String s = new String("2+2"); | |
for(int i = 1; i <= 10; i++){ | |
System.out.println("2 + "+ i); | |
} | |
} |