I hereby claim:
- I am nurkiewicz on github.
- I am nurkiewicz (https://keybase.io/nurkiewicz) on keybase.
- I have a public key whose fingerprint is 53BB 9925 9172 1BC4 5201 42A3 BC59 60D4 5F3C 7EA3
To claim this, I am signing this object:
| const fs = require('fs') | |
| const json = fs.readFileSync('large.json').toString() | |
| // Run this several times, collect times in spreadsheet, like an animal | |
| start = Date.now(); JSON.parse(json); Date.now() - start |
I hereby claim:
To claim this, I am signing this object:
| package com.nurkiewicz.mixit; | |
| import lombok.Value; | |
| import lombok.extern.slf4j.Slf4j; | |
| import org.junit.Test; | |
| import rx.Observable; | |
| import rx.observers.TestSubscriber; | |
| import rx.schedulers.Schedulers; | |
| import rx.schedulers.TestScheduler; |
| import spock.lang.Specification | |
| import spock.lang.Unroll | |
| import java.time.* | |
| @Unroll | |
| class BankSpec extends Specification { | |
| final ZoneId warsaw = ZoneId.of("Europe/Warsaw") | |
| def 'should calculate downtime also in DST'() { |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.beans.BeansException; | |
| import org.springframework.beans.factory.config.BeanPostProcessor; | |
| import org.springframework.stereotype.Component; | |
| import java.time.Duration; | |
| import java.time.Instant; | |
| import java.util.Map; | |
| import java.util.concurrent.ConcurrentHashMap; |
| final CronExpression cronExpression = new CronExpression("0 0 5 * * ?"); | |
| Date since = new Date(); | |
| for (int i = 0; i < 100; i++) { | |
| since = cronExpression.getNextValidTimeAfter(since); | |
| System.out.println(since); | |
| } |
| @Bean | |
| public EmbeddedServletContainerFactory embeddedServletContainerFactory() { | |
| final JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); | |
| factory.addServerCustomizers(server -> { | |
| MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); | |
| server.addEventListener(mbContainer); | |
| server.addBean(mbContainer); | |
| }); | |
| return factory; | |
| } |
| import java.nio.file.Path; | |
| import java.nio.file.Paths; | |
| /** | |
| * Solution: https://ideone.com/qcHw1f | |
| */ | |
| class Main { | |
| public static void main(String[] args) { | |
| Path path = Paths.get("/"); |
| scala> Stream. | |
| iterate("*"){_ + "*"}. | |
| take(5). | |
| foreach(println) | |
| * | |
| ** | |
| *** | |
| **** | |
| ***** |
| import static org.mockito.Mockito.doAnswer; | |
| //... | |
| doAnswer(slowly()).when(timeConsumingExternalServiceMock).process(); | |
| //... | |
| private static Answer<Object> slowly() { | |
| return new Answer<Object>() { |