Skip to content

Instantly share code, notes, and snippets.

StringWriter stringWriter = new StringWriter();
JAXBContext requestJaxbContext = JAXBContext.newInstance(Email.class);
Marshaller marshaller = requestJaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
@m-cakir
m-cakir / BaseFragment.java
Last active May 17, 2017 12:01
Android Base Classes
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public abstract class BaseFragment extends Fragment {
package com.mcakir.bootiful.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
@ConfigurationProperties("cache")
package com.mcakir.bootiful.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.KeyGenerator;
package com.mcakir.bootiful.services;
import com.mcakir.bootiful.models.Movie;
import com.mcakir.bootiful.repositories.MovieRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@m-cakir
m-cakir / OmdbApiHealthIndicator.java
Created October 7, 2017 14:59
Custom Health Indicator example
package com.mcakir.bootiful.actuators;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import java.net.URI;
@m-cakir
m-cakir / AndroidManifest.xml
Created December 1, 2017 20:00
Opencv Android SDK Initialization
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera"/>
<application
android:allowBackup="true"
@m-cakir
m-cakir / CreatorNotification.html
Created December 18, 2017 13:06
Send last form response as email (Google Doc Forms App Script) ====> https://github.com/m-cakir/apps-script-form-notifications-addon
<p><a href="<?= formUrl?>"><b><?= title ?></b></a> iletişim formuna ait şimdiye kadar toplamda <?= responses.length ?> mesaj iletilmiş.</p>
<p><a href="<?= sheet ?>">Tüm mesajları görmek için tıklayınız</a></p>
<p></p>
<table style="border-radius:2px;margin:20px 0 25px;min-width:400px;border:1px solid #eee" cellspacing="0" cellpadding="10" border="0">
<tbody>
<? for (var i = 0; i < responses.length; i++) { ?>
<tr style="background:#fbfbfb">
<td style="font-weight:bold;border-bottom:1px solid #eee;width:180px"><?= responses[i].question ?></td>
@m-cakir
m-cakir / gist:cd6e7eb80b7d689d27ac0845f963db09
Created January 26, 2018 09:56 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@m-cakir
m-cakir / app.js
Last active April 8, 2018 11:47
Hapi quick example
'use strict';
const Hapi = require('hapi');
// Create a server with a host and port
const server = Hapi.server({
host: 'localhost',
port: 8000
});