Skip to content

Instantly share code, notes, and snippets.

View jalispran's full-sized avatar
🎯
Focusing

Pranjal Gore jalispran

🎯
Focusing
View GitHub Profile
private byte[] generateQrImage(String content) throws WriterException, IOException {
// Create new configuration that specifies the error correction
Map<EncodeHintType, ErrorCorrectionLevel> hints = new HashMap<>();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
// Create a qr code with the url as content and a size of WxH px
BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, WIDTH, HEIGHT, hints);
// Load QR image
BufferedImage qrImage = MatrixToImageWriter.toBufferedImage(bitMatrix, new MatrixToImageConfig(BLACK, WHITE));
private BufferedImage getOverly(String logo) throws IOException {
ClassPathResource resource = new ClassPathResource(logo);
BufferedImage bufferedImage = ImageIO.read(resource.getInputStream());
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
int newWidth = WIDTH/6;
int newHeight = HEIGHT/6;
@jalispran
jalispran / Application.java
Last active March 14, 2020 16:23
Gist for Inversion of Control blog post. Find the blog post at https://pranjalgore.com/blog/
//class in application.jar
@SpringBootApplication
@ComponentScan(basePackages= "com.plugin") //scan classes in package com.plugin in plugin.jar
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
/*
export const post = (url, body, successCallback, failureCallback) => {
let requestOptions = {
method: 'POST',
body: body,
};
call(url, requestOptions, successCallback, failureCallback);
};
export const get = (url, successCallback, failureCallback) => {
let data = {
imei: 'dummyimei',
};
let url = URI.CHECK_IN();
post(url, {data: data},
res => handleResponse(res),
err => handleError(err));