Skip to content

Instantly share code, notes, and snippets.

@marvin
marvin / mysql_php_class.php
Created February 20, 2012 10:15
another php mysql class
<?
error_reporting(E_ALL);
/*
@ PHP5 Mysql-klasse
@ Copyright by Web Communication World (www.wccw.in)
@ Diese Klasse darf frei unter diesem Vermerk eingesetzt, verändert und weitergegeben werden
@ Weitere Klassen, sind auf www.wccw.in Kostenlos erhältlich
@marvin
marvin / basic_movingbox.html
Created February 26, 2012 19:56
moves a box around within a defined area. also some basic collision detection is done
<html>
<head>
<title>Game Programming with JavaScript, HTML and CSS: Introduction</title>
<style type='text/css'>
#game_region {
width: 600px;
height: 400px;
background-color: black;
position:relative;
@marvin
marvin / stopstart_movingbox.html
Created February 26, 2012 20:56
moving box in html,css and js will stop/start if S key is pressed or left button is clicked
<html>
<head>
<title>moving box - stops/starts on left click</title>
<style type='text/css'>
#game_region {
width: 600px;
height: 400px;
background-color: black;
position:relative;
@marvin
marvin / blink_browser.js
Created February 29, 2012 11:30
blinking title in browser with JS
<?php
if (!function_exists('imagecreatefrombmp')) { function imagecreatefrombmp($filename) {
// version 1.00
if (!($fh = fopen($filename, 'rb'))) {
trigger_error('imagecreatefrombmp: Can not open ' . $filename, E_USER_WARNING);
return false;
}
// read file header
$meta = unpack('vtype/Vfilesize/Vreserved/Voffset', fread($fh, 14));
@marvin
marvin / path_validator.php
Created March 13, 2012 21:44
gowfreak sein bildupload path validator
<?php
class Validate {
// validates if folder exists, is writeable and needs to be created
// it takes an array with paths as parameter
// usage:
// $paths = array("url1","url2","url3");
// val = new Validate();
// val->ecw($paths);
//
function ecw($paths){
@marvin
marvin / gamepanel.java
Created March 20, 2012 21:30
Java Default GamePanel with double buffering and some basic user input
package net.coderockers.gamepanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@marvin
marvin / ComparePixelColor.java
Created March 22, 2012 10:57
compare pixels in image
import java.io.*;
import java.awt.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
public class ComparePixelColor {
public static void main(String args[]) throws IOException{
File file= new File("res/redsquare.jpg");
BufferedImage image = ImageIO.read(file);
@marvin
marvin / CompareAllPixelColor.java
Created March 22, 2012 11:13
find out what it does
import java.io.*;
import java.awt.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
public class CompareAllPixelColor {
public static void main(String args[]) throws IOException{
File file= new File("res/rgbsquare.png");
BufferedImage image = ImageIO.read(file);
@marvin
marvin / HelloWorldWebServer.go
Created May 4, 2012 20:26
Go webserver example hello world
package main
import "fmt"
import "net/http"
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, WORLD!")
}
func main() {