Skip to content

Instantly share code, notes, and snippets.

View lynas's full-sized avatar

Md Sazzad Islam lynas

View GitHub Profile
private int fold(List<Integer> input) {
Integer res;
if (input.size() == 1) {
return input.get(0);
}else {
try {
res = input.get(0);
for (int i = 1; i < input.size(); i++) {
input.set(i, input.get(i) + res);
}
#include <iostream>
using namespace std;
int main()
{
string box1 = "good";
string box2 = "bad";
cout<< "Sakib " + box1 + box2+"\n";
@lynas
lynas / ankoFragment.java
Last active February 18, 2019 15:38
android fragment using anko
class MyFragment: Fragment(){
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return UI {
linearLayout{
editText()
button("OK")
}
}.view
}
}
@lynas
lynas / Hibernate.java
Last active May 19, 2016 20:12
Hibernate second level cache
## Hibernate second level cache
Dependency
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>5.1.0.Final</version>
</dependency>
@lynas
lynas / file.java
Last active May 22, 2016 12:19
Spring mvc thymeleaf with kotlin
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
@lynas
lynas / file.java
Created May 22, 2016 17:06
Jackson Kotlin Module
Jackson Kotlin Module
If you are using Jackson you are likely to want to add com.fasterxml.jackson.module:jackson-module-kotlin dependency in order to allow it to deal with data classes with no default constructor or with Kotlin collections.
In addition to the dependency, you need to register it in Jackson ObjectMapper:
@SpringBootApplication
open class Application {
@Bean
@lynas
lynas / Dockerfile
Created June 1, 2016 17:59
Running maven command
# Running maven command in docker maven container
FROM maven:3.2-jdk-7-onbuild
CMD mvn package exec:java
@lynas
lynas / layout.html
Created July 10, 2016 04:05
thymeleaf template
// this is the layout. Lets asume file name is given layoutRoot.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
</head>
<body>
<header>
# Original theme https://github.com/agnoster zsh theme
# modified by lborg019
ZSH_THEME_GIT_PROMPT_DIRTY='±'
function _git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
echo "${ref/refs\/heads\// }$(parse_git_dirty)"
}
package com.lynas.config
import com.github.mxab.thymeleaf.extras.dataattribute.dialect.DataAttributeDialect
import nz.net.ultraq.thymeleaf.LayoutDialect
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer