Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Michal Lipski michal-lipski

🏠
Working from home
View GitHub Profile
@michal-lipski
michal-lipski / EmailSender.java
Last active March 7, 2018 22:23
inversion_of_controll
View EmailSender.java
package com.app.email;
public interface EmailSender {
void send(String recipient, String message);
}
@michal-lipski
michal-lipski / git-user-activity.sh
Created September 15, 2017 12:30
Number of days in git project per user.
View git-user-activity.sh
# number of days beetween first and last commit by user
mapfile -t authors < <( git log --pretty=format:%an | sort | uniq )
echo "Number of authors:" ${#authors[@]}
for author in "${authors[@]}"
do
lastCommitDate=`git log --pretty=format:%at --author="$author" | sed -n 1p`
firstCommitDate=`git log --pretty=format:%at --author="$author" | tail -1`
if [ ! -z "$lastCommitDate" ];
View git-stats.sh
# avg number of commits per month in date range
input_start=2017-3-1
input_end=2017-9-1
startdate=$(date -I -d "$input_start") || exit -1
enddate=$(date -I -d "$input_end") || exit -1
d="$startdate"
sum=0
count=0
View 1_install_jenkins.md

Exercise 1. Download and install Jenkins

  1. Go to https://jenkins.io
  2. Download war file
  3. Run using java from Terminal java -jar jenkins.war
  4. Go to http://localhost:8080
  5. Customize with default plugins
  6. Cretate first Admin user
View Git.md
View Moneytransfer.java
BankAccountA{
void TransferMoneyTo(transactionToken,toAccountId,amount){
if(this.HasPendingTransactions){
throw new BusinessException("Transactions in process");
}
if(availableBalance-amount<0){
throw new BusinessException("...");
View ValueObjectContractTest.java
package com.pragmatists;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(JUnitParamsRunner.class)
View phaser.js
(function () {
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'game',
{preload: preload, create: create, update: update, render: render}
);
function preload() {
game.load.spritesheet('dude', '../assets/dude.png', 32, 48);
game.load.spritesheet('chick', '../assets/chick.png', 16, 18);