Skip to content

Instantly share code, notes, and snippets.

View tarrsalah's full-sized avatar
🐧

Salah Eddine Taouririt tarrsalah

🐧
View GitHub Profile
@tarrsalah
tarrsalah / ropeinternet.sml
Created February 26, 2013 00:44
solution the RopeInternet google codejam problem
(* solving the rope internet problem *)
exception Error
val min = Int.min
val inFile= TextIO.stdIn
val outFile= TextIO.stdOut
fun new_node (n1,n2) l =
(* how many nodes did this tuple introduce to the problem *)
@tarrsalah
tarrsalah / hoveFX.java
Created March 12, 2013 14:54
Change a button text when hovering
btn.textProperty().bind(
Bindings.when(new_btn.hoverProperty())
.then(new SimpleStringProperty("Hello!"))
.otherwise(new SimpleStringProperty("New"));
@tarrsalah
tarrsalah / InjectingFXMLLoader.java
Last active January 20, 2021 16:40
Generic FXMLLoader.
import java.io.IOException;
import java.net.URL;
import javafx.fxml.FXMLLoader;
import javafx.util.Callback;
/**
* InjectingFXMLLoader.java (UTF-8)
*
* Apr 13, 2013
* @author tarrsalah.org
@tarrsalah
tarrsalah / SimpleListView.java
Last active August 15, 2021 17:05
Simple Editable javafx ListView.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
@tarrsalah
tarrsalah / 256.sh
Created May 5, 2013 14:13
Print 256 colours.
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
import java.sql.*;
import java.util.logging.*;
import javafx.application.Application;
import javafx.collections.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
@tarrsalah
tarrsalah / path.sh
Created May 10, 2013 13:34
Print $PATH
function path(){
old=$IFS
IFS=:
printf "%s\n" $PATH
IFS=$old
}
#!/bin/bash
#
# pickjdk: provides a shell function that allows you to choose a JDK.
#
# The function sets JAVA_HOME and PATH On Linux or
# Windows, just set the environment variable JDKS_ROOT to the directory
# containing multiple versions of the JDK and the function will prompt you to
# select one. On OSX, JDKs will be discovered for you.
# JDKS_ROOT=/opt/jdk
@tarrsalah
tarrsalah / PathDrawing.java
Last active December 17, 2015 12:09
Images and Snapshots 2 in 1.
/**
* Created with IntelliJ IDEA.
* User: tarrsalah
* Date: 5/19/13
* Time: 2:25 PM
* To change this template use File | Settings | File Templates.
*/
import java.awt.*;
@tarrsalah
tarrsalah / ShakingStage.java
Created May 20, 2013 18:59
The ShakingStage.
import javafx.animation.KeyFrame;
import javafx.animation.RotateTransitionBuilder;
import javafx.animation.Timeline;
import javafx.animation.TimelineBuilder;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.SceneBuilder;
import javafx.scene.control.Button;