Skip to content

Instantly share code, notes, and snippets.

View TPei's full-sized avatar
🔨
team building

Thomas Karstens TPei

🔨
team building
  • Cint/Gapfish
  • Berlin, Germany
View GitHub Profile
var Person = function() {
var name;
var age;
var savings = 0.0;
this.getName = function() {
return name;
};
this.setName = function(value) {
@TPei
TPei / Methoden
Last active August 29, 2015 14:09
public class Methoden {
public static void main(String[] args){
// da kein return Wert, brauchen wir auch nichts speichern
ausgeben("Hallo Ausgabe");
// da keine Argumente erwartet, uebergeben wir auch keine
int zahl = gibDrei();
System.out.println(zahl);
public class String_Schleife {
public static void main(String[] args) {
// Arrays
// Datentyp[] meinArrayName = new Datentyp[anzahlderElemente];
// String array erstellen
String[] stringArray = new String[3]; // groesse muss festgelegt sein
// mit stringArray.length laesst sich die laenge des arrays (hier 4) abfragen
@TPei
TPei / Schleifen
Created October 15, 2014 15:13
Java DEMO Schleifen
public class C_Schleifen {
public static void main(String[] args){
// Fuer Programmteile die beliebig oft wiederholt werden sollen
// bietet Java Schleifen
// Beispiel: Zaehlervariable soll von 0 bis 10 in 1er Schritten erhoeht werden
int zaehler = 0;
@TPei
TPei / Bedingungen
Created October 15, 2014 15:12
Java DEMO Bedingungen
public class B_Bedingungen {
public static void main(String[] args) {
// Variablen a, b
int a = 10;
int b = 11;
// Ohne Bedingungen werden Java Programme Zeile für Zeile ausgewertet
@TPei
TPei / Zuweisungen
Created October 15, 2014 15:11
Java DEMO Zuweisungen
public class A_Zuweisungen {
public static void main(String[] args) {
// Deklarierung (ohne Wert)
int a;
int b, c, d;
// Initialisierung (mit Wertzuweisung)
a = 7;
@TPei
TPei / findByBlog
Last active August 29, 2015 14:05
Proposed improvement to typo3 flow documentation
/**
* Finds posts by the specified blog
*
* @param \TYPO3\Blog\Domain\Model\Blog $blog The blog the post must refer to
* @param integer $limit The number of posts to return at max
* @return \TYPO3\Flow\Persistence\QueryResultInterface The posts
*/
public function findByBlog(\TYPO3\Blog\Domain\Model\Blog $blog, $limit) {
$query = $this->createQuery();
$query->setLimit($limit);
@TPei
TPei / typo3constructors
Last active August 29, 2015 14:05
Proposed extesions to the typo3 documentation
PHP Code::
class Ship {
public $name;
public $coaches;
public $engineStatus;
public $speed;
function __construct($name, $coaches) {
@TPei
TPei / gist:7192129
Last active December 26, 2015 18:09
/**
* given three positions in an array a,
* checks which of those array elements is the median
* and returns the corresponding index
* if multiple elements are equal, returns second if appropriate
*
* @param first index of first element to compare
* @param second index of second element to compare
* @param third index of third element to compare
* @return the index of the found median element
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#LICENSE: WTFPL
#DEPENDS: on this cool font from http://asdasd.rpg.fi/~svo/glasstty/
#TODO: port to Python3
from time import sleep
from sys import stdout