This file contains hidden or 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 com.example.demo; | |
| import java.util.ArrayDeque; | |
| import java.util.Deque; | |
| public class JsonFixer { | |
| public String fix(String response) { | |
| String json = findJson(response); | |
| if (json == null || json.isEmpty()) { |
This file contains hidden or 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 javax.jms.Session; | |
| import org.apache.activemq.openwire.OpenWireFormatFactory; | |
| import org.apache.activemq.openwire.v12.MarshallerFactory; | |
| import org.apache.activemq.pool.PooledConnectionFactory; | |
| import org.apache.activemq.transport.TransportFactory; | |
| import org.apache.activemq.transport.nio.NIOSSLTransportFactory; | |
| import org.apache.activemq.transport.nio.NIOTransportFactory; | |
| import org.apache.activemq.transport.tcp.TcpTransportFactory; | |
| import org.apache.camel.Endpoint; | |
| import org.apache.camel.component.activemq.ActiveMQComponent; |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.1.1 r1855137"> | |
| <hashTree> | |
| <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> | |
| <stringProp name="TestPlan.comments"></stringProp> | |
| <boolProp name="TestPlan.functional_mode">false</boolProp> | |
| <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp> | |
| <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> | |
| <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | |
| <collectionProp name="Arguments.arguments"> |
This file contains hidden or 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.Map; | |
| import java.util.concurrent.ConcurrentHashMap; | |
| import java.util.concurrent.atomic.AtomicInteger; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.beans.BeansException; | |
| import org.springframework.beans.factory.annotation.Value; | |
| import org.springframework.cloud.stream.binder.Binding; | |
| import org.springframework.cloud.stream.binder.BindingCreatedEvent; |
This file contains hidden or 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 com.agiledeveloper; | |
| import java.util.*; | |
| class Fibonacci { | |
| public static int numberAtPosition(int position) { | |
| int current = 1; | |
| int next = 1; | |
| if(position < 2) return 1; |
This file contains hidden or 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
| def seriesUntilPosition(n: Int) = (0 until n) | |
| .map(x => (0,0)) | |
| .foldLeft((0,1))((acc, b) => (acc._2, acc._1 + acc._2))._2 | |
| def seriesUntil(n: Int) = (0 to n).map(fibo(_)) ( |
This file contains hidden or 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
| fun seriesUntilPosition(position: Int): List<Int> { | |
| return (1..position) | |
| .map { Pair(0, 1) } | |
| .fold(listOf(Pair(0, 1))) { acc, first -> | |
| val last = acc.last() | |
| acc + (Pair(last.second, last.first + last.second)) | |
| } | |
| .map { it.second } | |
| } |
This file contains hidden or 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.List; | |
| import java.util.Map; | |
| import java.util.Set; | |
| import static java.util.Comparator.comparing; | |
| import static java.util.stream.Collectors.*; | |
| public class Maps { | |
| public static Map<Integer, List<String>> listByScore(Map<String, Integer> scores) { |
This file contains hidden or 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.List; | |
| import java.util.stream.Collectors; | |
| import java.util.stream.IntStream; | |
| class NextInSeries { | |
| public final int current; | |
| public final int next; | |
| NextInSeries(int current, int next) { | |
| this.current = current; |
This file contains hidden or 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 React, { Component } from 'react'; | |
| import {MainContext} from './Context'; | |
| class Child extends Component { | |
| happy = main => main.onChangeStatus("happy :D") | |
| sad = main => main.onChangeStatus("sad :(") | |
| render() { | |
| return ( |
NewerOlder