Skip to content

Instantly share code, notes, and snippets.

Batuhan Bayrakci baybatu

Block or report user

Report or block baybatu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ufuk
ufuk / find-out-stale-branches.sh
Last active Oct 31, 2017
Lists git branches ordered by last change time to find out which ones are stale branches.
View find-out-stale-branches.sh
#!/bin/bash
# DESCRIPTION
# -----------
#
# Produces CSV output like this:
#
# LAST CHANGE TIME, TIME ELAPSED, AUTHOR, BRANCH
# 2017-01-16 14:56:26 +0000, 3 months ago, john.doe@example.com, origin/bug-fix-1
# 2017-01-23 18:27:53 +0300, 2 months ago, john.doe@example.com, origin/new-feature-1
@ufuk
ufuk / ComparingUtils.java
Last active Nov 24, 2017
Fluent API for comparing two Comparables.
View ComparingUtils.java
public class ComparingUtils {
public static <T extends Comparable<T>> ComparisonBuilder<T> is(T comparable) {
return new ComparisonBuilder<>(comparable);
}
public static class ComparisonBuilder<T> {
private Comparable<T> subject;
@livacengiz
livacengiz / detail.md
Last active Jul 30, 2018
Otomat Hackathon Detaylar
View detail.md

alt text

Nedir?

Creative coding (yaratıcı programlama) işlevsel olmasından çok yaratıcılığı ön plana çıkarmak için bilgisayar programları yazma işine verilen isimdir. Ortaya çıkan sonuçlar işitsel, görsel ya da başka herhangi bir formda olabilir.

Otomat, sürekli CRUD uygulamalar yapmaktan sıkılmış geliştiriciler olarak birlikte çok ilginç projeler geliştireceğimiz bir hackathon/creative coding partisi. 19-20 Kasım tarihlerinde (gece dahil) bir araya gelerek çok güzel görsel/işitsel ürünler üretip, çok güzel sohbetler edeceğiz.

Neler yapacağız?

Ne yapmak istiyorsanız! Yapılacak şey ve konu üzerine herhangi bir sınırlandırmamız yok. Ama etkinlik günü söyleyeceğimiz bazı teknik sınırlandırmalarımız olacak :) Bireysel olarak ya da grup olarak katılımak konusunda serbestsiniz. Hatta en güzeli herkesle yardımlaşmanız :)

@ufuk
ufuk / StartEndTimeWithJodaTime.java
Created Oct 24, 2016
Joda-Time library provides us a Virtual Clock utility named "DateTimeUtils". This is a demonstration for mocking start-end times.
View StartEndTimeWithJodaTime.java
import org.joda.time.DateTime;
public class StartEndTimeWithJodaTime {
private DateTime startTime;
private DateTime endTime;
public void process() {
startTime = DateTime.now();
@ufuk
ufuk / LazyDeveloper.java
Last active Jun 27, 2019
Just another reason to why you shouldn't use Lombok, in another saying another reason to why you should write unit tests: You have two fields in your class. Fields are in the same type. You use @AllArgsConstructor to auto-generate your all args constructor. It works for a moment, until you change the order of the field.
View LazyDeveloper.java
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class LazyDeveloper {
private String firstName;
private String lastName;
@ufuk
ufuk / HowToGetHttpServletRequestAndResponseProgrammatically.java
Created Oct 6, 2016
To get the request and response objects in Spring MVC projects you can use this code
View HowToGetHttpServletRequestAndResponseProgrammatically.java
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
HttpServletRequest httpServletRequest = servletRequestAttributes.getRequest();
HttpServletResponse httpServletResponse = servletRequestAttributes.getResponse();
@jonikarppinen
jonikarppinen / Messages.java
Last active Jul 17, 2019
Example of using message resources in Spring Boot service layer code, in as simple way as possible (hopefully!)
View Messages.java
package com.company.project.components;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.Locale;
@joemiller
joemiller / clone-all.sh
Last active May 6, 2019
clone all repos from an org, including private repos
View clone-all.sh
#!/bin/sh
# Reqs: curl, ruby, git
#
# TOKEN: Create a personal access token here: https://github.com/settings/tokens
#
# Usage:
#
# To clone all repos from $ORG into current directory:
#
# $ curl https://gist.githubusercontent.com/joemiller/2dd72670e37769cb647c/raw | TOKEN=<githubtoken> ORG=<orgname> bash
@ufuk
ufuk / BaseMockitoTest.java
Last active Apr 9, 2019
Performs "verify no more interactions" check automatically for all mock objects (works with Mockito version 2). For detailed description: https://ufukuzun.wordpress.com/2019/04/09/ne-olup-bittiginden-habersiz-testlere-derman-mockscollector/ (Turkish)
View BaseMockitoTest.java
import org.apache.commons.lang3.ArrayUtils;
import org.junit.After;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.runners.MockitoJUnitRunner;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.verifyNoMoreInteractions;
@RunWith(MockitoJUnitRunner.class)
View gist:4dc603b56399918bfb54
import re
import csv
import urllib
class Parse:
params = re.compile('(?P<key>[\S]*)=\{(?P<value>[\S]*)\}')
prep = re.compile('(?P<key>[\S]*)=(?P<value>[\S]*)')
You can’t perform that action at this time.