Skip to content

Instantly share code, notes, and snippets.

/**
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>
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
job(projectName) {
scm {
git {
remote {
url(projectURL)
credentials('admin')
}
}
}
triggers {
@Palayoub
Palayoub / pipeline.js
Created May 4, 2019 20:20
Pseudo code. 1.
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)
@Palayoub
Palayoub / test.java
Created September 29, 2016 13:45
Java program
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);
}
}