Skip to content

Commit

Permalink
Initial commit.. most things work
Browse files Browse the repository at this point in the history
Could use some more bloat cleanup from the theme
  • Loading branch information
austinwbest committed Jan 31, 2024
0 parents commit 441c59d
Show file tree
Hide file tree
Showing 255 changed files with 69,064 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/repositories/*
/index.html
64 changes: 64 additions & 0 deletions ajax/branches.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/*
----------------------------------
------ Created: 012824 ------
------ Austin Best ------
----------------------------------
*/

require 'shared.php';

if ($_POST['m'] == 'init') {
?><h3>Branches <?= '<br><code>./' . $repository ?></code></h3><hr><?php

$remoteLabel = false;
?>
<div class="row">
<h3>Local</h3>
<?php
foreach ($branches['shell'] as $index => $branch) {
if (!$remoteLabel && str_contains($branch, 'remotes/')) {
$remoteLabel = true;
?><h3>Remote</h3><?php
}
$branchHeadCommit = $git->commitInformation($branchHeads['shell'][$index]);
$commitStats = $git->commitStats($branchHeads['shell'][$index]);
$commitStats = array_slice($commitStats['shell'], -2, 1);
$author = trim(preg_replace('/\t+/', '', $branchHeadCommit['shell'][1]));
$date = trim(preg_replace('/\t+/', '', $branchHeadCommit['shell'][2]));
$notes = [];

for ($n = 3; $n < count($branchHeadCommit['shell']); $n++) {
if (str_contains($branchHeadCommit['shell'][$n], 'diff --')) {
break;
}
$notes[] = trim(preg_replace('/\t+/', '', $branchHeadCommit['shell'][$n]));
}
$notes = array_filter($notes);

$commitStats = str_replace('changed', '<span class="text-warning">changed</span>', $commitStats[0]);
$commitStats = str_replace('insertions', '<span class="text-success">insertions</span>', $commitStats);
$commitStats = str_replace('deletions', '<span class="text-danger">deletions</span>', $commitStats);

$commitStats = str_replace('insertion', '<span class="text-success">insertion</span>', $commitStats);
$commitStats = str_replace('deletion', '<span class="text-danger">deletion</span>', $commitStats);

?>
<div class="col-sm-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4><?= $branch ?></h4>
<div class="bg-gray-dark rounded p-3">
<?= $author ?><br>
<?= $date ?><br><br>
<?= $commitStats ?><br><br>
<ul><li><?= implode('</li><li>', $notes) ?></li></ul>
</div>
</div>
</div>
</div>
<?php
}
?></div><?php
}
99 changes: 99 additions & 0 deletions ajax/code.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php

/*
----------------------------------
------ Created: 012924 ------
------ Austin Best ------
----------------------------------
*/

require 'shared.php';

if ($_POST['m'] == 'init') {
?><h3>Code <?= '<br><code>./' . $repository ?></code></h3><hr><?php
$labels = $dataFiles = $dataLines = $colors = '';
$usedColors = [];
foreach ($fileTypes as $fileType => $fileTypeData) {
$randomColor = randomColor($usedColors);
$usedColors[] = $randomColor;

$labels .= ($labels ? ',' : '') . "'" . $fileType . "'";
$dataFiles .= ($dataFiles ? ',' : '') . intval($fileTypeData['files']);
$dataLines .= ($dataLines ? ',' : '') . intval($fileTypeData['lines']);
$colors .= ($colors ? ',' : '') . "'" . $randomColor . "'";
}
?>
<div class="col-sm-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<div class="bg-gray-dark d-flex d-md-block d-xl-flex flex-row py-3 px-4 px-md-3 px-xl-4 rounded mt-3">
<div class="col-xs-12 col-sm-6">
<h4 class="card-title">Types</h4>
<div class="card">
<div class="card-body">
<canvas id="fileType"></canvas>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<h4 class="card-title">Lines</h4>
<div class="card">
<div class="card-body">
<canvas id="fileLines"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var ctx = document.querySelector('#fileType').getContext('2d');
var chart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: [<?= $labels ?>],
datasets: [{
label: 'Types',
data: [<?= $dataFiles ?>],
backgroundColor: [<?= $colors ?>],
color: '#FFFFFF',
hoverOffset: 4
}]
},
options: {
legend: {
position: 'left',
labels: {
fontColor: 'white',
fontSize: 18
}
}
}
});
var ctx = document.querySelector('#fileLines').getContext('2d');
var chart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: [<?= $labels ?>],
datasets: [{
label: 'Types',
data: [<?= $dataLines ?>],
backgroundColor: [<?= $colors ?>],
color: '#FFFFFF',
hoverOffset: 4
}]
},
options: {
legend: {
position: 'left',
labels: {
fontColor: 'white',
fontSize: 18
}
}
}
});
</script>
<?php
}
200 changes: 200 additions & 0 deletions ajax/commits.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<?php

/*
----------------------------------
------ Created: 012824 ------
------ Austin Best ------
----------------------------------
*/

require 'shared.php';

if ($_POST['m'] == 'init') {
?><h3>Commits <?= '<br><code>./' . $repository ?></code></h3><hr><?php

$regex = '/{(?<hash>(.*))}~{(?<date>(.*))}~{(?<relative>(.*))}~{(?<branch>(.*))}~{(?<note>(.*))}~{(?<authorName>(.*))}~{(?<authorEmail>(.*))}/';

$yearData = $monthData = $weekData = $dayData = [];
foreach ($overview['shell'] as $commit) {
$details = str_replace($tree, '', $commit);
$details = preg_match($regex, $details, $matches);

if ($matches['date']) {
$timestamp = strtotime(str_replace('date:', '', $matches['date']));
$yearData[date('Y', $timestamp)]++;
if (count($monthData) <= 36) { //-- 3 YEARS
$monthData[date('Y-m', $timestamp)]++;
}
if (count($weekData) <= 26) { //-- 26 WEEKS (6 MONTHS)
$weekData[date('Y-W', $timestamp)]++;
}
if (count($dayData) <= 30) { //-- 30 DAYS (1 MONTH)
$dayData[date('Y-m-d', $timestamp)]++;
}
}
}
ksort($yearData);
ksort($monthData);
ksort($weekData);
ksort($dayData);

$dailyLabels = $dailyData = '';
foreach ($dayData as $key => $val) {
$label = date('M. d, y', strtotime($key));

$dailyLabels .= ($dailyLabels ? ',' : '') . "'" . $label . "'";
$dailyData .= ($dailyData ? ',' : '') . "'" . $val . "'";
}

$weeklyLabels = $weeklyData = '';
foreach ($weekData as $key => $val) {
list($year, $week) = explode('-', $key);

$weeklyLabels .= ($weeklyLabels ? ',' : '') . "'" . $year . " week " . $week . "'";
$weeklyData .= ($weeklyData ? ',' : '') . "'" . $val . "'";
}

$monthlyLabels = $monthlyData = '';
foreach ($monthData as $key => $val) {
$label = date('M. y', strtotime($key . '-1 12:00:00'));

$monthlyLabels .= ($monthlyLabels ? ',' : '') . "'" . $label . "'";
$monthlyData .= ($monthlyData ? ',' : '') . "'" . $val . "'";
}

$yearlylabels = $yearlyData = '';
foreach ($yearData as $key => $val) {
$yearlylabels .= ($yearlylabels ? ',' : '') . "'" . $key . "'";
$yearlyData .= ($yearlyData ? ',' : '') . "'" . $val . "'";
}

?>
<div class="col-sm-12 grid-margin stretch-card">
<div class="card">
<div class="row">
<div class="col-xl-6 col-sm-12">
<div class="card-body">
<h4>Daily</h4>
<div class="bg-gray-dark d-flex d-md-block d-xl-flex flex-row py-3 px-4 px-md-3 px-xl-4 rounded mt-3">
<canvas id="commits-daily"></canvas>
</div>
</div>
</div>
<div class="col-xl-6 col-sm-12">
<div class="card-body">
<h4>Weekly</h4>
<div class="bg-gray-dark d-flex d-md-block d-xl-flex flex-row py-3 px-4 px-md-3 px-xl-4 rounded mt-3">
<canvas id="commits-weekly"></canvas>
</div>
</div>
</div>
<div class="col-xl-6 col-sm-12">
<div class="card-body">
<h4>Monthly</h4>
<div class="bg-gray-dark d-flex d-md-block d-xl-flex flex-row py-3 px-4 px-md-3 px-xl-4 rounded mt-3">
<canvas id="commits-monthly"></canvas>
</div>
</div>
</div>
<div class="col-xl-6 col-sm-12">
<div class="card-body">
<h4>Yearly</h4>
<div class="bg-gray-dark d-flex d-md-block d-xl-flex flex-row py-3 px-4 px-md-3 px-xl-4 rounded mt-3">
<canvas id="commits-yearly"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var ctx = document.querySelector('#commits-daily').getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
data: {
labels: [<?= $dailyLabels ?>],
datasets: [{
label: 'Daily Commits (Last 30 active days)',
data: [<?= $dailyData ?>],
borderColor: '#36A2EB',
backgroundColor: '#9BD0F5'
}]
},
options: {
scales: {
x: {
type: 'time',
parser: 'YYYY-MM-DD'
}
}
}
});

var ctx = document.querySelector('#commits-weekly').getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
data: {
labels: [<?= $weeklyLabels ?>],
datasets: [{
label: 'Weekly Commits (Last 26 active weeks)',
data: [<?= $weeklyData ?>],
borderColor: '#36A2EB',
backgroundColor: '#9BD0F5'
}]
},
options: {
scales: {
x: {
type: 'time',
parser: 'YYYY-MM-DD'
}
}
}
});

var ctx = document.querySelector('#commits-monthly').getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
data: {
labels: [<?= $monthlyLabels ?>],
datasets: [{
label: 'Monthly Commits (Last 36 active months)',
data: [<?= $monthlyData ?>],
borderColor: '#36A2EB',
backgroundColor: '#9BD0F5'
}]
},
options: {
scales: {
x: {
type: 'time',
parser: 'YYYY-MM-DD'
}
}
}
});

var ctx = document.querySelector('#commits-yearly').getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
data: {
labels: [<?= $yearlylabels ?>],
datasets: [{
label: 'Yearly Commits',
data: [<?= $yearlyData ?>],
borderColor: '#36A2EB',
backgroundColor: '#9BD0F5'
}]
},
options: {
scales: {
x: {
type: 'time',
parser: 'YYYY-MM-DD'
}
}
}
});
</script>
<?php
}
Loading

0 comments on commit 441c59d

Please sign in to comment.