Skip to content

Instantly share code, notes, and snippets.

View LinuxDoku's full-sized avatar

Martin Lantzsch LinuxDoku

View GitHub Profile
<?php
// Zustz vom Ort trennen - Unter Zusatz läuft nur nicht Kartenmaterial
// Dieser Filter erlaubt nur folgende Patterns:
// Erlaubter Zusatz, Ortsname Ortszusatz (Strassen, Postleitzahl, Bekanntes Gebäude)
// Alles vor dem Zeichen wird mittels RegEx entfernt
$location = $_GET['location'];
$location = preg_replace('/([a-zA-Z0-9 ])*, /', '', $location);
?>
<br />
Tabelle: datastore
id type sid name value
1 page 1 title Testseite
2 page 1 body Dies ist …
3 page 1 autor Martin
4 page 2 title Impressum
5 page 2 body Ansprech..
6 page 2 autor Admin
7 comment 3 autor Gast
8 comment 3 mail mail@do…
function loadmap() {
// config
imageX = 326;
imageY = 271;
iX = 0;
iY = 0;
// create new div's for each image px
// start with X
while(iX <= imageX)
<?php
// coords
$destX = 22;
$destY = 10;
$actX = 70;
$actY = 12;
// now go to destination
while(($actX < $destX || $actX > $destX) && ($actY < $destX || $actY > $destY))
{
// standard time - remember, time 1 second --> 1000
var time = 2000;
// our function to load the map
function loadMap(newTime) {
if(newTime == 4000) {
time = 2000;
}
$("#r3").load('response.php');
window.setTimeout("loadMap("+time+");", time);
<?php
// coords
$destX = 1;
$destY = 1;
$actX = 5;
$actY = 7;
// now go to destination
while(($actX <= $destX || $actX >= $destX) && ($actY <= $destX || $actY >= $destY))
{
/**
* Slide between 3 tweets in 3 div's.
*
* @param int display The tweet to start
*/
function tweetSlider(display) {
if(display == 0) {
// hide tweets
$('#tweet_1').hide();
$('#tweet_2').hide();
@LinuxDoku
LinuxDoku / jamedo.php
Created August 29, 2011 20:27
Download Jamedo Songs
<?php
if(isset($_GET['id'])) {
$trackID = (int)$_GET['id'];
// get download url
$trackUrl = file_get_contents('http://www.jamendo.com/get/track/id/track/audio/plain/'.$trackID.'/?aue=ogg2');
if($trackUrl == false) {
echo 'track id not availible!';
} else {
// get track information
$trackTitle = (string)file_get_contents('http://www.jamendo.com/get/album/id/album/title/plain/'.$trackID.'/');
@LinuxDoku
LinuxDoku / gist:1319745
Created October 27, 2011 14:47
Dualzahlen zu Dezimalzahlen umrechnen
<?php
$numbers = str_split('101110111010');
$result = 0;
foreach($numbers as $number) {
$result *= 2;
$result += $numbers[array_search($number, $numbers) + 1];
}
echo $result;
@LinuxDoku
LinuxDoku / gist:1322126
Created October 28, 2011 12:03
Dezimal zu Dual
<?php
$number = 141;
$result = '';
while($number != 0) {
$result .= $number % 2;
$number = floor($number / 2);
}
echo strrev($result);