Skip to content

Instantly share code, notes, and snippets.

View turkdogan's full-sized avatar

Turkdogan Tasdelen turkdogan

View GitHub Profile
@turkdogan
turkdogan / FibonacciDP.java
Created July 23, 2021 09:36
Fibonacci number of first 30 numbers with dynamic programming in Java
import java.util.stream.IntStream;
public class FibonacciDP {
public static void main(String[] args) {
IntStream.rangeClosed(0, 30).forEach(
v -> System.out.println(fibonacci(v)));
}
private static int fibonacci(int value) {
@turkdogan
turkdogan / HelloWorldController.kt
Last active April 6, 2021 18:45
Minimal Hell World RestController with SpringBoot+Kotlin
package dev.turkdogan.springboothelloworld
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
class HelloWorldController {
@RequestMapping("/")
fun home(): String {
@turkdogan
turkdogan / add_custom_button_to_center_navbar.swift
Created May 25, 2020 14:10
Add Button to the Center of Navigation Bar in Swift (iOS 13)
let button = UIButton(type: .custom)
button.frame = CGRect(x: 0, y: 0, width: 100, height: navBarHeight)
button.setImage(UIImage(systemName: "square.and.arrow.up"), for: .normal)
button.addTarget(self, action: #selector(share), for: .touchUpInside)
navigationItem.titleView = button
@turkdogan
turkdogan / tt_matrix.h
Last active June 3, 2017 11:38
A simple, header only C++ matrix library
#ifndef TT_MATRIX_H
#define TT_MATRIX_H
#include <valarray>
#include <algorithm>
#include <string>
#include <assert.h>
template <typename T>
class TTMatrix
@turkdogan
turkdogan / spacemacs_cheat_sheet.md
Last active June 3, 2017 11:44
spacemacs cheat sheet

Neotree

  • Open Neotree: f t
  • Open file at the cursor: l
  • Open file in new vertical window: |
  • Open file in new horizontal window -
  • Create file: c
  • Rename file: r
  • Delete file: d
  • Refresh: gr
@turkdogan
turkdogan / .vimrc
Last active March 29, 2017 08:55
My vimrc configuration
syntax enable
if 0 | endif
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
@turkdogan
turkdogan / GetRestRequest.cs
Created February 23, 2017 21:26
A Simple Get Request in C#
public static void RequestWeather()
{
const string url = "http://api.geonames.org/weatherJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&username=demo";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
var webResponse = request.GetResponse();
var webStream = webResponse.GetResponseStream();
var responseReader = new StreamReader(webStream);
var response = responseReader.ReadToEnd();
import tensorflow as tf
a = tf.constant(10)
b = tf.constant(20)
y = tf.mul(a, b)
with tf.Session() as sess:
print ("%d should equat to 200" % sess.run(y))