Skip to content

Instantly share code, notes, and snippets.

View lynas's full-sized avatar

Md Sazzad Islam lynas

View GitHub Profile
package com.lynas.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
public Response postPatchDelete(HttpServletRequest request, String url, String method, Object object) {
Client client = ClientBuilder.newClient();
try {
return client
.target(REST_URL_BASE + url)
.request()
.header(X_AUTH_TOKEN, getToken(request))
.build(
method,
Entity.entity(
package com.lynas.service.impl;
import com.lynas.Util;
import com.lynas.model.Account;
import com.lynas.model.AccountTransaction;
import com.lynas.model.Book;
import com.lynas.model.util.BalanceSheet;
import com.lynas.service.AccountTransactionService;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Order;
package com.lynas.service.impl;
import com.lynas.model.AppUser;
import com.lynas.service.AppUserService;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@lynas
lynas / backgroundTask.swift
Created March 8, 2017 01:02
Running task on background that will not pause if home button is pressed
func doUpdate () {
DispatchQueue.global(qos: .background).async {
let taskID = self.beginBackgroundUpdateTask()
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(5), execute: {
print("printing after 10 min")
})
DispatchQueue.main.async {
self.endBackgroundUpdateTask(taskID: taskID)
}
}
@lynas
lynas / introrx.md
Created February 21, 2017 11:54 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
struct Person {
let name : String
let age : Int
}
let personArray = [
Person(name: "name1", age: 11),
Person(name: "name2", age: 12),
Person(name: "name3", age: 13)
]
@lynas
lynas / rxswift.swift
Created February 2, 2017 08:49
rx swift simple binding
import UIKit
import RxCocoa
import RxSwift
class ViewController: UIViewController {
@IBOutlet weak var txt1: UITextField!
@IBOutlet weak var txt2: UITextField!
gradle init --type pom

##parent pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.lynas</groupId>
    <artifactId>parent</artifactId>