Skip to content

Instantly share code, notes, and snippets.

View zubayerahamed's full-sized avatar
🕶️
Coffee, Coke, Code, Cool

Zubayer Ahamed zubayerahamed

🕶️
Coffee, Coke, Code, Cool
View GitHub Profile
@zubayerahamed
zubayerahamed / image_preview_jquery.html
Last active February 5, 2018 17:26
View image preview in a div when uploading
<!DOCTYPE html>
<html>
<head>
<title>Image Preview</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<style type="text/css">
#uploadPreview {
border: 1px solid red;
width: 200px;
height: 200px;
@zubayerahamed
zubayerahamed / DeleteFile.java
Last active February 7, 2018 14:37
How to delete a file in java
import java.io.File;
public class DeleteFile
{
public static void main(String[] args)
{
try{
File file = new File("c:\\logfile20100131.log");
if(file.delete()){
System.out.println(file.getName() + " is deleted!");
@zubayerahamed
zubayerahamed / data-table-nosort.html
Created February 10, 2018 05:15
jQuery DataTable example (Disable sorting on specific column)
<html>
<head>
<title>Datatable</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap.min.css"/>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap.min.js"></script>
</head>
<body>
@zubayerahamed
zubayerahamed / UploadController.java
Last active April 11, 2018 12:44
File Upload system in Spring Boot App
package com.coderslab.controller;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
@zubayerahamed
zubayerahamed / index.html
Last active February 12, 2018 06:07
Green Chat Room UI Design
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Green chat room - CodeGuru.me</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="textt/css" href="style.css"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
@zubayerahamed
zubayerahamed / index.html
Created February 13, 2018 17:17
Thymeleaf Tags Usages
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Thymeleaf tags usage</title>
</head>
<body>
<!-- Class append -->
<li th:classappend="${pageTitle='HOME'} ? active"><a href="">Home</a></li>
<!-- Attribute append -->
<button th:attrappend="data-url=${userSlug != null} ? @{/myaccount/}"></button>
@zubayerahamed
zubayerahamed / HomeController.java
Created February 17, 2018 05:17
Create a Timer event using jquery and ajax
package com.coderslab;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@zubayerahamed
zubayerahamed / index.html
Last active February 18, 2018 02:34
jQuery Print
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>jQuery.Print</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
<div id="print-element">
@zubayerahamed
zubayerahamed / EmailMessages.java
Created February 19, 2018 12:42 — forked from adityasatrio/EmailMessages.java
Email using java email, velocity engine, spring
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.csl.cms.util.email;
import java.io.File;
import java.util.Map;
import org.springframework.core.io.InputStreamSource;
@zubayerahamed
zubayerahamed / MailController.java
Last active August 6, 2019 11:22
Send email using velocity template and attach a file
package com.coderslab.controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Properties;
import javax.activation.DataHandler;