Skip to content

Instantly share code, notes, and snippets.

@timaschew
timaschew / Cube3DTest.java
Created August 6, 2011 17:39
3D Cube Animation with Mouse Moving and Rotation (press Shift (and ALT))
package de.unikassel.threeD.misc;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Cube3DTest extends JFrame implements MouseListener, MouseMotionListener,
Field[] fields = MaxLearnIterationsStrategy.class.getDeclaredFields();
for (Field f : fields) {
Class<?> type = f.getType();
System.out.println(f.getName() + " / " + type.getSimpleName());
try {
Class cls = Class.forName(MaxLearnIterationsStrategy.class.getName());
Field fld = cls.getField(f.getName());
fld.setAccessible(true);
Object obj = cls.newInstance();
if (f.getType().equals(Integer.class)) {
@timaschew
timaschew / ColorHelper.java
Created September 28, 2011 22:18
creating a colormap: number -> color (gradient: blue to red)
/**
* Projekt ANNtool
*
* Copyright (c) 2011 github.com/timaschew/jANN
*
* timaschew
*/
package de.unikassel.ann.util;
import java.awt.Color;
@timaschew
timaschew / gist:1326542
Created October 30, 2011 22:32
arduino random music maker
int soundPin = 8;
int ledPin = 6;
int min1 = 0;
int max1 = 500;
int min2 = 100;
int max2 = 1000;
int zzz = 2;
void setup() {
@timaschew
timaschew / doctrine-non-pk-fk-patch.php
Created September 28, 2012 14:16
patch file for using foreign keys to non pk reference (only for ManyToOne)
diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
index d73983c..9f8a253 100644
--- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
+++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
@@ -598,10 +598,18 @@ class BasicEntityPersister
$quotedColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->_class, $this->_platform);
$this->quotedColumns[$sourceColumn] = $quotedColumn;
-
- if ($newVal === null) {
@timaschew
timaschew / toc-excerp-fix.js
Last active December 19, 2015 00:18
Confluence Anchor with the Excerp Include Macro: If you a TOC (table of contents) macro within a excerp macro the generated hyperlinks have html achnors. When using the excerp include macro the hyperlinks don't work. There is no HTTP request, only the anchor of the current page will be changed. To fix it, use this script. Can be embeded it at th…
<script type="text/javascript">
jQuery(document).ready(function($) {
//console.log(">>>>>>>>>>>>>>>>>>>>>>>>>> hello from custom toc");
var panel = $("div.panel div.panelHeader");
var panelContent = $("div.panel div.panelContent h2");
if (typeof(panel) != 'undefined' && typeof(panelContent) != 'undefined') {
var pages = $(".panelHeader:first-child");
@timaschew
timaschew / Makefile
Created July 4, 2013 12:13
check return value of a shell script that was executed with make's 'shell'
CHECK := $(shell shell-script param > /dev/null; echo $$?)
ifneq ($(CHECK),0)
$(error "error message")
endif
@timaschew
timaschew / confluence_pagetree_extension.html
Last active May 19, 2016 09:44
expand children pages in pagetree for current page. Put this into the textarea of: Confluence Admin -> LOOK AND FEEL -> Custom HTML -> At end of the HEAD
<!--
Original snippet is from
http://www.communardo.de/home/techblog/2011/05/02/improve-the-confluence-pagetree-macro-functionality/
-->
<script type="text/javascript" >
AJS.toInit(function ($) {
//first save the original pagetree function "origHideEmptyChildrenContainer"
var origHideEmptyChildrenContainer = AJS.pagetree.hideEmptyChildrenContainers;
@timaschew
timaschew / test.coffee
Created July 25, 2013 14:06
js2coffe improvment test file.coffee
module.exports = container:
page:
numbers: [
1
2
3
"four"
"five"
]
one: ["value"]
@timaschew
timaschew / custom_html_to_head.js
Last active November 19, 2016 15:29
confluence table sum addon
<script type="text/javascript" >
AJS.toInit(function ($) {
var list = AJS.$('table.confluenceTable tbody th:contains("#sum")');
list.each(function(index, item) {
var elem = AJS.$(item);
var parentRow = elem.parent();
var parentTbody = parentRow.parent();
var column = parentRow.find('th').index(elem);
var sum = 0;