Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Gossmann gossi

View GitHub Profile
@gossi
gossi / gist:728625
Created Dec 5, 2010
Spacetree Label fitInNode
View gist:728625
$jit.ST.Label.Native = new Class({
Implements: Graph.Label.Native,
renderLabel: function(canvas, node, controller) {
var ctx = canvas.getCtx(),
coord = node.pos.getc(true),
height = 0, maxHeight, lineHeight, restText, testLastLine, textSplit,
width = node.getData("width"), modifyLastLine = false, lines, i, len, y;
if (!canvas.viz.config.Node.autoWidth && ctx.measureText(node.name).width > width) {
@gossi
gossi / gist:729240
Created Dec 5, 2010
JIT Node Extension: Advanced Rectangle with rounded borders
View gist:729240
/**
* JIT Advanced Rectangle
*
* Usage
* =====
*
* Node: {
* overridable: true,
* type: "adv-rect",
* CanvasStyles: {
@gossi
gossi / gist:899912
Created Apr 2, 2011
Ideas for defining properties on Javascript "classes"
View gist:899912
// Method 1:
MyClass = Class({
extends : "AnotherClass",
mixins : ["Event"],
construct : function () {
console.log("constructor message");
},
@gossi
gossi / gist:1044628
Created Jun 24, 2011
Storing php listeners in a database
View gist:1044628
This is about storing php listeners in a database.
Listeners are typically stored on objects waiting for an event using the Observer design pattern. Looks like this:
$myListener = new MyListener();
$myRecord->addlistener($myListener);
// or
$myRecord->addListener('event.created', $myListener);
From my point of view, the listener parameter of the addListener method could handle 4 different types of listeners:
@gossi
gossi / gist:1307151
Created Oct 23, 2011
Deadlock Problem in JS.Class
View gist:1307151
<!doctype html>
<html>
<head>
<title>JS.Class loader</title>
<script type="text/javascript">JSCLASS_PATH = 'lib/jsclass-3.0.4/min'</script>
<script type="text/javascript" src="lib/jsclass-3.0.4/min/loader-browser.js"></script>
</head>
<body>
<script type="text/javascript">
JS.require('JS.Class', function() {
@gossi
gossi / gist:1934685
Created Feb 28, 2012
Bresenham Algorithmus
View gist:1934685
function setPixel(x, y) {
console.log("Pixel auf %s/%s", x, y);
}
function bresenham(start, end) {
var dx = end.x - start.y,
dy = end.y - start.y,
x = start.x,
y = start.y,
err = dx / 2;
@gossi
gossi / dabblet.css
Created Apr 5, 2012
CSS Animations (auto values)
View dabblet.css
/**
* CSS Animations (auto values)
*/
#anim {
border: 1px solid;
padding: 3px;
background-color: green;
color: white;
width: auto;
transition: width 1s;
@gossi
gossi / grep-repos.sh
Last active Jun 9, 2017
Shell script to pull git repositories in vendor/repo format
View grep-repos.sh
#!/bin/sh
###########################
## Shell script to clone a list of github repositories and run `mvn clean install` on each one of them
##
## Authors: Robert Gründler, Thomas Gossmann
## Usage: put a file called `repos.txt` in the folder of the script containing the repository URLs, line by line:
##
## https://github.com/pulse00/Composer-Eclipse-Plugin.git
## git@github.com:pulse00/Symfony-2-Eclipse-Plugin.git
@gossi
gossi / gist:5928634
Last active Dec 19, 2015
Keeko Stub App
View gist:5928634
<?php
class Stub extends AbstractApp {
public function run(Request $req) {
$router = new ModuleActionRouter('stub', $this->appRouter->getPrefix());
$route = $router->match($this->appRouter->getDestination());
$main = '';
try {
$moduleManager = new ModuleManager($this->classLoader);
View dabblet.css
/**
* css-variables
*/
:root {
var-bg: red;
}
div {
margin: 20px;