Skip to content

Instantly share code, notes, and snippets.

View haisi's full-sized avatar
🇨🇭

Hasan Kara haisi

🇨🇭
View GitHub Profile
@haisi
haisi / EditableTableFX.java
Last active May 20, 2023 19:20
Editable JavaFX TableView with textfield, datepicker and dropdown menu
/*
* Just copy and paste the code.
*/
package editabletableview;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Date;
@haisi
haisi / countEachChar.groovy
Created June 30, 2016 11:29
Groovy-Script to count each character in passed file and prints them in ascending order
#! /usr/bin/env
// Example
// groovy countEachChar.groovy MY_TEXTFILE > OUT_PUT_TEXT_FILE
def printErr = System.err.&println
if (args.length == 0) {
printErr "No path is passed as an argument! Exiting!"
return;
def content = "https://google.com".toURL().text
writeToFile("C:/tmp", "fhnw-job-ausschreibung", "html", content)
public void writeToFile(String directory, String fileName, String extension, def content) {
new File("$directory/$fileName.$extension").withWriter { out ->
out.println content
}
}
import org.springframework.beans.factory.InjectionPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.DependencyDescriptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.web.context.annotation.SessionScope;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
@haisi
haisi / .gitconfig
Last active December 22, 2016 13:55
Git Aliases
[core]
autocrlf = true
excludesfile = ~/.gitignore
[alias]
unstage = reset -q HEAD --
discard = checkout --
nevermind = !git reset --hard HEAD && git clean -d -f
uncommit = reset --mixed HEAD~
save = commit -m
resave = commit --amend
var webdriver = require('selenium-webdriver');
var keyword = "Magic";
var driver = new webdriver.Builder().
usingServer('http://localhost:4444/wd/hub/').
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys(keyword);
driver.findElement(webdriver.By.name('btnG')).click();
@haisi
haisi / useful-commands.sh
Last active March 20, 2020 17:35
useful-commands
# chrome commands and JS
## Change the playback rate of all videos on a page
document.querySelector('video').playbackRate = 1.2
# start a jupyter notebook from any folder
jupyter notebook .
# start a minimal react-app
npm install -g create-react-app
create-react-app react-hello-world
@haisi
haisi / commands.sh
Created March 23, 2020 20:55
docker on windows 8.1
# Create the VirtualBox VM running a mini Linux with Docker (name 'default')
docker-machine create --driver=virtualbox
docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "10.0.0.1/24" default
# See all machines
docker-machine ls
docker-machine env default
eval "$(docker-machine env default)"