Skip to content

Instantly share code, notes, and snippets.

View nitschmann's full-sized avatar

Florian Nitschmann nitschmann

  • solarisBank AG
  • Germany
View GitHub Profile
@nitschmann
nitschmann / sublime_text_commandline.sh
Last active December 22, 2015 15:29
Script to install Sublime Text 2 'subl' command for your terminal on Mac OS X
# !/bin/sh
user="$(whoami)"
bin_dir="/Users/$user/bin"
if [ ! -d "$bin_dir" ]
then
echo "Create directory $bin_dir\n"
mkdir "$bin_dir"
fi
command_line="/Applications/Sublime Text 2.app/Contents/SharedSupport/bin"
@nitschmann
nitschmann / potenz.java
Last active December 17, 2015 19:49
Simple recursive function for potency in Java
int potency(int basis, int exponent) {
if(exponent == 1) return basis;
else return this.potenz(basis, exponent-1)*basis;
}
@nitschmann
nitschmann / ArrayMultiUnique.php
Created October 23, 2012 09:54
PHP function to clean double entries multidimensional arrays
public function array_multi_unique($multiArray){
$uniqueArray = array();
foreach($multiArray as $subArray) {
if(!in_array($subArray, $uniqueArray)) {
$uniqueArray[] = $subArray;
}
}
return $uniqueArray;
}
@nitschmann
nitschmann / BinaereSuche.java
Created October 14, 2012 21:00
Methode zur binären Suche in Java
public static int binaereSuche(int[] feld, int x)
{
int unten=0, mitte=0, oben=feld.length;
while (unten<oben)
{
mitte=(unten+oben)/2;
if (feld[mitte]==x)
{
return mitte+1;
}
@nitschmann
nitschmann / LinarlySearch.java
Created October 14, 2012 20:55
Java method for linearly search
static int linearlySearch(int[] field, int searchIndex) {
for (int i = 0; i < field.length; i++)
if (field[i] == searchIndex)
return i;
return -1; // -1 no valid index
}
@nitschmann
nitschmann / QuickSort.java
Created September 28, 2012 16:44
JAVA class to sort numeric arrays
/**
* Easy JAVA class to sort numeric arrays
*
* @author Florian Nitschmann (f.nitschmann@googlemail.com)
* @version 0.1
*/
public class QuickSort {
/*
* void sort - Sort an numeric array
@nitschmann
nitschmann / Interface.java
Created March 27, 2012 19:39
Heron-Verfahren
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* Interface.java
*
* Created on 27.03.2012, 21:01:59
*/
@nitschmann
nitschmann / fractionArithmetic.java
Created March 27, 2012 07:39
A class for easy fractions in Java
/**
*
* @author Florian Nitschmann
* @version 1.0
*/
public class fractionArithmetic {
/*
* Variablen für den Bruch (Zähler und Nenner)
*