Skip to content

Instantly share code, notes, and snippets.

View arnabmitra's full-sized avatar
🙈

Arnab Mitra arnabmitra

🙈
View GitHub Profile
Spring to JAX-RS Cheat Sheet
This is not an exhaustive list, but it does include the most common annotations.
Spring Annotation JAX-RS Annotation
@RequestMapping(path = "/troopers" @Path("/troopers")
@RequestMapping(method = RequestMethod.POST) @POST
@RequestMapping(method = RequestMethod.GET) @GET
@RequestMapping(method = RequestMethod.DELETE) @DELETE
@ResponseBody N/A
@RequestBody N/A
- jaxrs-api - This is RESTeasy's packaging of the spec. It is not the official spec jar, but it does adhere to the spec contracts. RESTeasy uses this jar for the entire spec line, i.e. 1.x - current. Though the jar does change internals to adhere to the different JAX-RS versions.
- jsr311-api - This is the official spec jar for the JAX-RS 1.x line.
- javax.ws.rs-api - This is the official spec jar for the JAX-RS 2.x line.
- jersey-core - This is a partial implementation of the spec. The rest of the implementation is contained inside other Jersey jars. Note that in earlier versions of Jersey, they actually packaged the JAX-RS spec APIs into this jar. It wasn't until later that it starting using the official spec jars.
forkJoinPool.submit(() ->
range(1, 1_000_000).parallel().filter(PrimesPrint::isPrime)
.collect(toList())
).get();
Kafka Server —>Kafka broker —> Kafka Node refer to the same thing.
Kafka Broker
A Kafka broker is a Kafka server that hosts topics.
Locally start a kafka broker aka kafka server
start zookeeper —> {kafka_home}/bin/zookeeper-server-start.sh config/zookeeper.properties
start kafka server —> {kafka_home}/bin/kafka-server-start.sh config/server.properties
import javax.inject.Inject;
@Import(value = {LocalDbAuthConfig.class,CassandraAvailabiltyConfig.class})
@Configuration
@EnableRetry
@EnableAspectJAutoProxy
@EnableDbAuthPropertySupport
public class CassandraConfig extends AbstractCassandraConfiguration {
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="http://fb.me/react-0.12.2.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
@arnabmitra
arnabmitra / sbt
Last active September 21, 2017 22:42
sbt test:compile
sbt "test:testOnly *ScenarioModeServiceV1ImplTest"
sbt -jvm-debug 9001
>run 9001
class Order(val qty:Int)
enum class BeverageType {COFFEE,TEA}
class ChargeManagement
{
companion object {
import java.math.BigDecimal
data class Application(val name:String,val score :BigDecimal)
fun main(args:Array<String>)
{
val total:BigDecimal = listOf<Application>(Application("a", BigDecimal("100")),Application("b",BigDecimal("100")))
.map( {it.score})
import React from 'react';
import { HashRouter as Router, Switch, Route } from 'react-router-dom';
import SomeTool from '../../containers..';
import SomeComp from '../../containers/..';
const App = () => (
<Router>
<Switch>
<Route path="/some-tool/:appId" exact component={c} />
<Route path="/some-comp/:id" exact component={SomeComp} />