Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3073231d38 | |||
| 0d522e1cd1 | |||
| eefefef0d9 | |||
| cf1ffd6b1e | |||
| a169383fda | |||
| 1968bb7ad9 | |||
| 2ec4eadabe | |||
| 16bdbab1ab | |||
| 092f8f0950 | |||
| a4262f8f8f |
@@ -1,3 +0,0 @@
|
||||
assorted old projects
|
||||
|
||||
A longer description goes here.
|
||||
@@ -1,3 +1,3 @@
|
||||
@echo off
|
||||
|
||||
start C:\bin\cygwin\bin\mintty.exe /bin/bash -l -c "rsync -avz -e ""ssh -i /cygdrive/c/www/ms1_deploy_key -p 2222"" --progress /cygdrive/c/www/m6/code/wwwroot www-data@ms1.ivysaur.me:~/code.ivysaur.me/"
|
||||
start C:\path\to\cygwin\bin\mintty.exe /bin/bash -l -c "rsync -avz -e ""ssh -i /cygdrive/c/path/to/deploy_key"" --progress /cygdrive/c/path/to/code/wwwroot www-data@your-web-server:/var/www/path/to/code-site/"
|
||||
|
||||
8
homepage_blurb.htm
Normal file
8
homepage_blurb.htm
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
<p>
|
||||
Homepage blurb goes here.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>PROJECTS</strong>
|
||||
</p>
|
||||
@@ -1,3 +1,3 @@
|
||||
@echo off
|
||||
C:\bin\php54\php.exe rebuild.php
|
||||
C:\path\to\php_54\php.exe rebuild.php
|
||||
pause
|
||||
112
rebuild.php
112
rebuild.php
@@ -7,18 +7,18 @@
|
||||
// `````````````
|
||||
|
||||
define('BASEDIR', __DIR__.'\\');
|
||||
define('SITE_TITLE', 'code.ivysaur.me');
|
||||
define('SITE_TITLE', 'codesite');
|
||||
define('PAGE_THUMB_W', 60);
|
||||
define('PAGE_THUMB_H', 60);
|
||||
define('INDEX_THUMB_W', 90);
|
||||
define('INDEX_THUMB_H', 30);
|
||||
define('INDEX_THUMB_H', 32); // recommend a multiple of the jpg iDCT block size
|
||||
|
||||
/**
|
||||
* Create a thumbnail of an image. It overscales, centers, and crops to fit the
|
||||
* target dimensions.
|
||||
*
|
||||
* @param string $src_file
|
||||
* @param string $dest_file
|
||||
* @param string $dest_file Null to return an image handle
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @return boolean
|
||||
@@ -45,7 +45,27 @@ function mkthumbnail($src_file, $dest_file, $width, $height) {
|
||||
$width, $height, $box_w, $box_h
|
||||
);
|
||||
|
||||
imagedestroy($im);
|
||||
|
||||
if (is_null($dest_file)) {
|
||||
return $dest;
|
||||
} else {
|
||||
return imagejpeg($dest, $dest_file);
|
||||
}
|
||||
}
|
||||
|
||||
function mkspritesheet(array $handles, $dest_file, $width, $height) {
|
||||
$im = imagecreatetruecolor($width, $height * count($handles));
|
||||
|
||||
for($i = 0, $e = count($handles); $i != $e; ++$i) {
|
||||
imagecopy($im, $handles[$i], 0, $i * $height, 0, 0, $width, $height);
|
||||
}
|
||||
|
||||
if (is_null($dest_file)) {
|
||||
return $dest_file;
|
||||
} else {
|
||||
return imagejpeg($im, $dest_file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,10 +114,20 @@ function hesc($sz) {
|
||||
}
|
||||
|
||||
function text2html($sz) {
|
||||
$base = nl2br(hesc($sz));
|
||||
$base = hesc($sz);
|
||||
$base = preg_replace('~(https?://[^ \\r\\n\\t]+)~i', '<a href="\\1">\\1</a>', $base);
|
||||
|
||||
preg_replace('~(https?://.+\b)~i', '<a href="\1">\1</a>', $base);
|
||||
return $base;
|
||||
$base = preg_replace('~=+(.+)=+~', '<strong>\\1</strong>', $base);
|
||||
|
||||
$btparts = explode('`', $base);
|
||||
if (count($btparts) > 1 && (count($btparts) % 2)) {
|
||||
for ($i = 1, $e = count($btparts); $i < $e; $i += 2) {
|
||||
$btparts[$i] = '<span class="code">'.$btparts[$i].'</span>';
|
||||
}
|
||||
$base = implode('', $btparts);
|
||||
}
|
||||
|
||||
return nl2br($base);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,11 +138,12 @@ class CProject {
|
||||
private $dir;
|
||||
public $projname;
|
||||
public $shortdesc = '(no description)';
|
||||
public $subtag = '';
|
||||
private $longdesc = '';
|
||||
private $images = array();
|
||||
private $downloads = array();
|
||||
|
||||
public $homeimage = 'no_image.png';
|
||||
public $homeimage = null;
|
||||
|
||||
public function __construct($dirname, $projname) {
|
||||
$this->dir = BASEDIR.'data/'.$dirname.'/';
|
||||
@@ -126,7 +157,13 @@ class CProject {
|
||||
|
||||
if ($file == 'README.txt') {
|
||||
$this->longdesc = file_get_contents($this->dir.'README.txt');
|
||||
$matches = array();
|
||||
if (preg_match('~Written in ([^\\r\\n]+)~', $this->longdesc, $matches)) {
|
||||
$this->subtag = rtrim($matches[1], ' .');
|
||||
}
|
||||
|
||||
$this->shortdesc = array_shift(explode("\n", $this->longdesc));
|
||||
$this->shortdesc[0] = strtolower($this->shortdesc[0]); // cosmetic lowercase
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -150,12 +187,11 @@ class CProject {
|
||||
}
|
||||
|
||||
if (count($this->images)) {
|
||||
mkthumbnail(
|
||||
$this->homeimage = mkthumbnail(
|
||||
BASEDIR.'wwwroot/srv/'.$this->projname.'_0.'.str_ext($this->images[0]),
|
||||
BASEDIR.'wwwroot/srv/'.$this->projname.'_headimg.jpg',
|
||||
null, // raw handle
|
||||
INDEX_THUMB_W, INDEX_THUMB_H
|
||||
);
|
||||
$this->homeimage = 'srv/'.$this->projname.'_headimg.jpg';
|
||||
}
|
||||
|
||||
// Copy downloads to wwwroot
|
||||
@@ -174,11 +210,11 @@ class CProject {
|
||||
|
||||
public function index() {
|
||||
?>
|
||||
<h2><a href="index.html"><?=hesc(SITE_TITLE)?></a> > <?=hesc($this->projname)?></h2>
|
||||
<h2><?=hesc($this->projname)?></h2>
|
||||
|
||||
<div class="projinfo">
|
||||
|
||||
<div class="projbody">
|
||||
<div class="projbody projbody_<?=(count($this->images) ? 'half' : 'full')?>w">
|
||||
|
||||
<strong>ABOUT</strong>
|
||||
|
||||
@@ -231,6 +267,7 @@ function template($title, $content) {
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="content">
|
||||
<a href="index.html"><div id="bannerlogo"></div></a>
|
||||
<?=$content?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -263,7 +300,7 @@ function buildall() {
|
||||
// List projects
|
||||
|
||||
$ls = scandir(BASEDIR.'data');
|
||||
sort($ls);
|
||||
rsort($ls);
|
||||
$projects = array();
|
||||
foreach($ls as $dirname) {
|
||||
if ($dirname[0] == '.') continue;
|
||||
@@ -279,54 +316,57 @@ function buildall() {
|
||||
$plist = array();
|
||||
$count = 0;
|
||||
|
||||
$handles = array();
|
||||
$handle_lookup = array();
|
||||
|
||||
foreach($projects as $dirname => $projectname) {
|
||||
|
||||
echo sprintf("[%2d/%2d] ".$projectname."...", ++$count, count($projects));
|
||||
echo sprintf("[%3d/%3d] ".$projectname."...", ++$count, count($projects));
|
||||
|
||||
$pr = new CProject($dirname, $projectname);
|
||||
$pr->write();
|
||||
$plist[] = $pr;
|
||||
|
||||
if (is_null($pr->homeimage)) {
|
||||
$handle_lookup[$projectname] = null;
|
||||
} else {
|
||||
$handle_lookup[$projectname] = count($handles);
|
||||
$handles[] = $pr->homeimage;
|
||||
}
|
||||
|
||||
echo " done\n";
|
||||
}
|
||||
|
||||
// Build homepage spritesheet
|
||||
|
||||
mkspritesheet($handles, BASEDIR.'wwwroot/logos.jpg', INDEX_THUMB_W, INDEX_THUMB_H);
|
||||
array_map('imagedestroy', $handles); // free
|
||||
|
||||
// Build index page
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<h2><?=hesc(SITE_TITLE)?></h2>
|
||||
|
||||
<img src="overview.jpg" class="headimg">
|
||||
|
||||
<p>
|
||||
This page contains several assorted projects, which no longer have any relation. They are listed in roughly chronological order (newest first). <strong>Unless specified otherwise</strong>, you may feel free to use and modify both the binaries and any source code, for any purpose, on the general condition you do not misrepresent who the author is (BSD license).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Some of these projects formerly appeared on Google Code <a href="https://code.google.com/p/mappy/">here</a>, but were moved following the discontinuation of the Google Code binary download system.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For bug reports, feature requests, or if you need any help, please
|
||||
<a
|
||||
href="http://www.google.com/recaptcha/mailhide/d?k=01GuAWzMc9JjSdooo-2KCMQA==&c=kgR3dBrP39yhPIy8FvLFbuBLmWqorQBDc_Zjbw6NAmU="
|
||||
onclick="window.open('http://www.google.com/recaptcha/mailhide/d?k\07501GuAWzMc9JjSdooo-2KCMQA\75\75\46c\75kgR3dBrP39yhPIy8FvLFbuBLmWqorQBDc_Zjbw6NAmU\075', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;"
|
||||
title="Reveal this e-mail address"
|
||||
>click here</a> to email me.
|
||||
</p>
|
||||
|
||||
<img src="projects.jpg" class="headimg">
|
||||
<?php if (file_exists(BASEDIR.'homepage_blurb.htm')) { ?>
|
||||
<!-- homepage blurb {{ -->
|
||||
<?=file_get_contents(BASEDIR.'homepage_blurb.htm')?>
|
||||
<!-- }} -->
|
||||
<?php } ?>
|
||||
|
||||
<table class="projtable">
|
||||
<?php foreach ($plist as $pr) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?=hesc(urlencode($pr->projname))?>.html"><img src="<?=hesc($pr->homeimage)?>" class="homeimage"></a>
|
||||
<a href="<?=hesc(urlencode($pr->projname))?>.html"><?=(is_null($handle_lookup[$pr->projname]) ? '<div class="no-image"></div>' : '<div class="homeimage homeimage-sprite" style="background-position:0 -'.($handle_lookup[$pr->projname]*INDEX_THUMB_H).'px"></div>')?></a>
|
||||
</td>
|
||||
<td>
|
||||
<strong><?=hesc($pr->projname)?></strong>,
|
||||
<?=hesc($pr->shortdesc)?>
|
||||
<a href="<?=hesc(urlencode($pr->projname))?>.html">more...</a>
|
||||
<?php if (strlen($pr->subtag)) { ?>
|
||||
<br>
|
||||
<small><?=hesc($pr->subtag)?></small>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
BIN
static/header.png
Normal file
BIN
static/header.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 860 B After Width: | Height: | Size: 436 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
@@ -12,6 +12,10 @@ a:hover {
|
||||
h1,h2,h3 {
|
||||
margin-top:0;
|
||||
}
|
||||
.code {
|
||||
background: #F8F8F8;
|
||||
font-family:Consolas,monospace;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
@@ -48,13 +52,21 @@ html, body {
|
||||
/* */
|
||||
|
||||
.projtable {
|
||||
|
||||
border-collapse: collapse;
|
||||
width:100%;
|
||||
}
|
||||
.projtable tr {
|
||||
border-collapse: collapse;
|
||||
transition:0.2s linear;
|
||||
}
|
||||
.projtable tr:hover {
|
||||
background:#F8F8F8;
|
||||
}
|
||||
.projtable td {
|
||||
padding: 4px;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
.projtable small {
|
||||
color:grey;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
.projinfo {
|
||||
@@ -63,17 +75,30 @@ html, body {
|
||||
.projbody {
|
||||
position:absolute;
|
||||
left:0;
|
||||
right: 64px;
|
||||
}
|
||||
.projbody_halfw {
|
||||
right: 74px;
|
||||
}
|
||||
.projbody_fullw {
|
||||
right:0;
|
||||
}
|
||||
.projimg {
|
||||
position:absolute;
|
||||
right:0;
|
||||
|
||||
width:60px;
|
||||
width:62px; /* 60px + 2px border */
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
#bannerlogo {
|
||||
width:631px;
|
||||
height:35px;
|
||||
margin:0 auto;
|
||||
background: white url('header.png') no-repeat 0 0;
|
||||
padding:8px;
|
||||
}
|
||||
|
||||
.headimg {
|
||||
width:310px;
|
||||
height:62px;
|
||||
@@ -81,7 +106,11 @@ html, body {
|
||||
|
||||
.homeimage {
|
||||
width:90px;
|
||||
height:30px;
|
||||
height:32px;
|
||||
}
|
||||
|
||||
.homeimage-sprite {
|
||||
background: white url('logos.jpg') no-repeat 0 0;
|
||||
}
|
||||
|
||||
.thumbimage {
|
||||
@@ -89,7 +118,15 @@ html, body {
|
||||
height:60px;
|
||||
opacity: 0.8;
|
||||
transition:0.2s opacity;
|
||||
border:1px solid lightgrey;
|
||||
}
|
||||
.thumbimage:hover {
|
||||
opacity:1.0;
|
||||
}
|
||||
|
||||
.no-image {
|
||||
width:90px;
|
||||
height:32px;
|
||||
display:block;
|
||||
background: white url('no_image.png') no-repeat 0 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user