Instantly share code, notes, and snippets.

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
final HttpServletRequest req = (HttpServletRequest) request;
final String authHeader = req.getHeader("authorization");
if (authHeader == null || !authHeader.startsWith("Bearer ")) {
throw new ServletException("Missing or invalid Authorization header");
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
public class AuthenticationController { ...
@ApiOperation(value = "Validate the user login")
public ResponseEntity<?> userLogin(@RequestBody User user) {
String jwtToken = "";
hello.greeting= nice to meet you
hello.version= 2.0
package demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
public class HelloController {
View manifest.yml
- name: hello-boot
instances: 1
host: hello-boot-${random-word}
path: target/hello-boot-1.0.jar
View simple-inefficient-quicksort-algo
// Sort an array using a simple but inefficient quicksort.
public int[] quicksortSimple(int[] data) {
if (data.length < 2) {
return data;
int pivotIndex = data.length / 2;
int pivotValue = data[pivotIndex];
int leftCount = 0;
// Count how many are less than the pivot
/* Mentioning all the swagger changes made on top of
Spring REST app: */
Modified File: pom.xml
package com.codinko.springrestapi.vo;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
// Generic class that can have data of generic type. See it's usage when an instance of this class is created
public class APIContract<T> {
private boolean success;
private String message;
View samplePOMwithnothing.xml
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
View SelectFromMysqlUsingPHPPDO.php
class Config {
public static $dbserver = "localhost";
public static $username = "usernamemax";
public static $pwd = "Compl$#1Pwd";
public static $dbname = "sampledb";