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
// What films does planet Tatooine shows up in? | |
// http://swapi.dev/api/planets/1/ | |
// Functional-style friendly functions | |
function get(url) { | |
return axios.get(url).then(r => r.data) | |
} | |
function getAll(urls) { | |
return Promise.all(urls.map(get)) |
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 sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} |
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
package io.github.bcalmac.overtime.server.utils; | |
import java.io.IOException; | |
import java.net.URISyntaxException; | |
import java.net.URL; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
public class OvertimeTestUtils { |
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
package io.github.bcalmac.scratch; | |
import com.fasterxml.jackson.annotation.JsonFormat; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.SerializationFeature; | |
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; | |
import lombok.Data; | |
import org.junit.jupiter.api.Test; |
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 org.springframework.format.FormatterRegistry; | |
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; | |
import org.springframework.stereotype.Component; | |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |
/** | |
* Override date/time formatters with ones using ISO-8601. | |
*/ | |
@Component | |
public class DateTimeFormatConfigurer implements WebMvcConfigurer { |
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
-- a^0 mod b is 1. Once we find the next power with a remainder of 1, the remainders will repeat. | |
-- Take from a list until the first element repeats | |
takeUntilFirstRepeats (x:xs) = x : takeWhile (/= x) xs | |
remaindersOfPowers a b = takeUntilFirstRepeats [a^i `mod` b | i <- [0..]] | |
-- Example | |
remaindersOfPowers 9 7 |
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.time.Instant; | |
import org.threeten.extra.Interval; | |
import com.fasterxml.jackson.annotation.JsonAutoDetect; | |
import com.fasterxml.jackson.annotation.JsonCreator; | |
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
// Exclude JavaBean properties that are not part of the state |
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 static com.github.tomakehurst.wiremock.client.WireMock.aResponse; | |
import static com.github.tomakehurst.wiremock.client.WireMock.anyUrl; | |
import static com.github.tomakehurst.wiremock.client.WireMock.get; | |
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; | |
import static org.junit.Assert.assertEquals; | |
import wiremock.org.apache.http.client.utils.URIBuilder; | |
import java.net.URI; | |
import java.net.URISyntaxException; |
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.io.IOException; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
public class DuplicateLogging { | |
private static final Logger logger = LoggerFactory.getLogger(DuplicateLogging.class); | |
public static void main(String[] args) throws IOException, InterruptedException { |
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 org.junit.Test; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import org.openqa.selenium.support.ui.WebDriverWait; | |
public class StackOverflowSearchExample { | |
@Test |
NewerOlder