Skip to content

Instantly share code, notes, and snippets.

@yusufsoysal
yusufsoysal / gist:47442b5ed1131c88bfff559820836a4e
Created March 18, 2017 16:36
Intellij IDEA JUnit4 Test Class Template
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
#parse("File Header.java")
#set($lastIndex = $CLASS_NAME.lastIndexOf(".") + 1)
#set($onlyClassName = $CLASS_NAME.substring($lastIndex))
@baybatu
baybatu / see-java-jar-file-content.md
Created March 16, 2016 07:21
Listing .jar file content from command-line
jar tf my-jar-file.jar
@baybatu
baybatu / creditcard-parser.js
Last active January 26, 2016 07:44
Parses credit card number with 16 characters into groups including 4 characters.
/*
* Example usage: parseCreditCard('1234567890123456') -> [ '1234', '5678', '9012', '3456' ]
*/
function parseCreditCard(cardNumber) {
return cardNumber.match(/.{1,4}/g);
}
@baybatu
baybatu / groovy-generic-metod-hatasi.md
Last active January 14, 2016 07:46
Groovy Generic Metod Ayıklama Hatası

Groovy'de

// derleme hatası
<T> void execute(Request<T> request) {
  // kodlar
}

tarzı bir metot imzası ayıklama hatasına(parsing error) sebep olur.

@MikeNGarrett
MikeNGarrett / siege
Last active December 3, 2024 17:20
Siege with JSON POST data
# Changed to use content-type flag instead of header: -H 'Content-Type: application/json'
siege -c50 -t60S --content-type "application/json" 'http://domain.com/path/to/json.php POST {"ids": ["1","2","3"]}'
@douglas
douglas / update_git_repos.sh
Created October 14, 2011 15:04
Update all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do