Skip to content

Instantly share code, notes, and snippets.

@afsinka
afsinka / Application.kt
Created Nov 14, 2020
Kotlin Spring Boot REST Example
View Application.kt
package com
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
@SpringBootApplication
class Application
fun main(args: Array<String>) {
SpringApplication.run(Application::class.java, *args)
View ImageController.java
import io.swagger.api.ImagesApi;
import io.swagger.model.GetImagesResponse;
import io.swagger.model.Image;
import java.io.InputStream;
import java.util.Base64;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
View MyClass.java
public class MyClass {
private MyDatabase myDatabase;
public String getCustomerName(long customerNo) {
System.out.println("getCustomerName() is called!");
return myDatabase.query(customerNo)+"_FROM_DATABASE";
}
public MyDatabase getMyDatabase() {
View Main.java
package com;
public class Main {
public static void main(String[] args) {
MyString myString = new MyString("x");
String str = "x";
System.out.println("1: " + myString.getName() + " " + str);
foo(myString, str);
View app.module.ts
import { NgModule } from "@angular/core";
import { HttpModule, Http } from "@angular/http";
import { FormsModule, FormBuilder } from "@angular/forms";
import { BrowserModule } from "@angular/platform-browser";
import { App } from "./app";
import { ReCaptchaModule } from 'angular2-recaptcha';
import { TranslateModule, TranslateLoader } from "@ngx-translate/core";
import { TranslateHttpLoader } from "@ngx-translate/http-loader";
export function HttpLoaderFactory(httpClient: Http) {
@afsinka
afsinka / index.html
Created Aug 2, 2017
Filter in Select Option List With Textbox (Old Browser)
View index.html
<script type="text/javascript">
$(document).ready(function() {
$("#searchBoxForOldBrowsers").keyup(function() {
searchInListForOldBrowsers();
});
});
@afsinka
afsinka / index.html
Created Aug 2, 2017
Filter in Select Option List With Textbox
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<title>Title</title>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
@afsinka
afsinka / FormView.java
Created Jan 28, 2017
Show PDF Files With PrimeFaces
View FormView.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
@afsinka
afsinka / WelcomeAction.java
Created Oct 29, 2016
Struts 2 Hello World
View WelcomeAction.java
package com.afsinka;
public class WelcomeAction {
private String name;
public String getName() {
return name;
}
@afsinka
afsinka / Main.java
Created Aug 7, 2016
Apache CXF Client Example
View Main.java
package com.cxf.client;
public class Main {
public static void main(String[] args) {
HelloWorldService service = new HelloWorldService();
String response = service.getHelloWorldPort().sayHi("client");
System.out.println("Service said: " + response);