Skip to content

Instantly share code, notes, and snippets.

View Athihusky's full-sized avatar

Athesis Husky Athihusky

  • Germany
View GitHub Profile
@Athihusky
Athihusky / add_month
Created March 10, 2015 15:25
PHP Date-Function to add Calendar-Month to a specified Date and can handle leap years
<?php
function add_month($startdate,$month) {
$anyDate = date("Y-m-d",strtotime($startdate . " +1 days"));
$nextDate = date("Y-m-d",strtotime($anyDate . " +".$month." month"));
$checkDate = date("Y-m-d",strtotime($nextDate . " -".$month." month"));
if($anyDate != $checkDate){
list($yr,$mn,$da) = split('-',$anyDate); // separate date
$mn = $mn + $month;
$timestamp = mktime(0,0,0,$mn,1,$yr);
list($y,$m,$t) = split('-',date('Y-m-t',$timestamp));
@Athihusky
Athihusky / spacebase.php
Last active August 29, 2015 14:02 — forked from sj26/spacebase.rb
Hack / Read Spacebase saves
<?php
//Spacebase Savegame-Reader in PHP
//Rewritten by Athesis Breda
//Original by sj26, https://gist.github.com/sj26/
//Read Save-File
$file = file_get_contents('./SpacebaseDF9AutoSave.sav', true);
//RAW Inflate Savefile
$compressed = gzinflate($file, 280000000 );