Skip to content

Instantly share code, notes, and snippets.

View laszlokorte's full-sized avatar

Laszlo Korte laszlokorte

View GitHub Profile
@laszlokorte
laszlokorte / Main.java
Last active August 29, 2015 14:24
JScrollpane and Textarea
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import javax.swing.Box;
// Only scalar values, both for parameters and return values.
// Calculation must be split into 2 methods. Ugly code, duplicate calculations.
public final class VectorMath {
public static double getRotatedX(final double x, final double y,
final double angle) {
return x * Math.cos(angle) - y * Math.sin(angle);
}
<?php
final class Secure
{
const LINEBREAK_WIDTH = 50;
private static $charset = 'utf-8';
/*
*
* Alle HTML-Befehlszeichen aus einem String in HTML-Entities umwandeln
<?php
//Startguthaben definieren
define("startguthaben", 100);
define("waehrung", "$");
session_start();
<?php
class Secure
{
private static $charset = 'utf-8';
/*
*
* Alle HTML-Befehlszeichen aus einem String in HTML-Entities umwandeln
*
*/
<?php
/*
*
* Secure Class
*
*/
class Secure
<?php
/*
*
* Secure Class
*
*/
class Secure
<?php
class ClansphereAbcode {
# alle registered patter
private static $patterns = array();
public static function convert($string, $options = array()) {
$string = self::secure($string);
foreach(self::$patterns AS $pat => $func) {
$string = preg_replace_callback($pat, $func, $string);
<?php
class Secure
{
private static $charset = 'utf-8';
/*
*
* Alle HTML-Befehlszeichen aus einem String in HTML-Entities umwandeln
*
*/
<?php
final class ClansphereAbcode
{
private static $cache = array();
public static function load()
{
Abcode::register(new AbcodePattern('bold', "/\[b\](.*?)\[\/b\]/si","<strong>$1</strong>"), TRUE);