Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions app/Console/Commands/FroozeRepositories.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,13 @@ class FroozeRepositories extends Command {
*/
protected $description = 'Load and frooze oldest and starred repositories';

/**
* Execute the console command.
*/
public function handle() {
$client = new GithubApi();
$repositories = $client->getOldestStarredRepositories();

FrozenRepository::truncate();

private function insertRepositories(array $list, bool $forRoad) {
FrozenRepository::insert(
array_map(
function ($rep) {
function ($rep) use ($forRoad) {
return array(
'created_at' => Carbon::now(),
'forRoad' => $forRoad,
'name' => $rep->name,
'githubId' => $rep->id,
'fullName' => $rep->fullName,
Expand All @@ -54,7 +47,21 @@ function ($rep) {
'ownerAvatarUrl' => $rep->owner->avatarUrl,
'year' => $rep->createdAt->format('Y'),
);
}, $repositories)
}, $list)
);
}

/**
* Execute the console command.
*/
public function handle() {
$client = new GithubApi();
$oldRepos = $client->getOldestStarredRepositories();
$roadRepos = $client->getRoad();

FrozenRepository::truncate();

$this->insertRepositories($oldRepos, false);
$this->insertRepositories($roadRepos, true);
}
}
78 changes: 57 additions & 21 deletions app/Console/Commands/ProLangAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,23 @@ private function updateLinks() {
'SPARK' => array(
'mainRepository' => 'https://github.com/AdaCore/spark2014?utm_source=chatgpt.com',
),
'Turbo Pascal' => array(),
'Turbo Pascal OOP' => array(),
'Turbo Pascal' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/keskival/turbo-pascal-experiments/refs/heads/master/DISK/COOL.PAS',
),
'Turbo Pascal OOP' => array(
'rawCode' => <<<'EOD'
type object-identifier = object
private
field1 : field-type;
field2 : field-type;
...
public
procedure proc1;
function f1(): function-type;
end;
var objectvar : object-identifier;
EOD
),
'Vala' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Vala/fibonacci-sequence-2.vala',
),
Expand Down Expand Up @@ -518,22 +533,21 @@ function member
y tl -> y repeat up
EOD
),
// TODO update / check
'R' => array(
'mainRepository' => 'https://github.com/wch/r-source',
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/r/R.R',
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/R/fibonacci-sequence-1.r',
),
'Python' => array(
'mainRepository' => 'https://github.com/python/cpython',
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/p/Python%203.py',
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Python/fibonacci-sequence-15.py',
),
'C#' => array(
'mainRepository' => 'https://github.com/dotnet/roslyn',
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/c/CSharp.cs',
),
'Erlang' => array(
'mainRepository' => 'https://github.com/erlang/otp',
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Erlang/fibonacci-sequence-4.erl',
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Erlang/fibonacci-sequence-1.erl',
),
'Nim' => array(
'mainRepository' => 'https://github.com/nim-lang/Nim',
Expand All @@ -560,7 +574,7 @@ function member
),
'SNOBOL' => array(
'mainRepository' => 'https://github.com/seanpm2001/Learn-SNOBOL?tab=readme-ov-file#Version-history',
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/s/SNOBOL',
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/SNOBOL4/fibonacci-sequence-2.sno',
),
'FORTRAN' => array(
'mainRepository' => 'https://github.com/fortran-lang',
Expand All @@ -580,7 +594,7 @@ function member
),
'Go' => array(
'mainRepository' => 'https://github.com/golang/go',
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/g/Go.go',
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Go/fibonacci-sequence-2.go',
),
'BCPL' => array(
'mainRepository' => 'https://github.com/8l/bcpl',
Expand Down Expand Up @@ -616,7 +630,7 @@ function member
),
'Lua' => array(
'mainRepository' => 'https://github.com/lua/lua',
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/l/Lua.lua',
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Lua/fibonacci-sequence-2.lua',
),
'Racket' => array(
'mainRepository' => 'https://github.com/racket/racket',
Expand Down Expand Up @@ -806,10 +820,11 @@ function member
END
EOD
),
// TODO empty
'BASIC FOUR' => array(),
'Boehm unnamed coding system' => array(),
'CLIPPER' => array(),
'CLIPPER' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/c/Clipper.prg',
),
'CLU' => array(),
'COMAL' => array(),
'COMIT' => array(),
Expand All @@ -820,11 +835,15 @@ function member
'CS-4' => array(),
'Claire' => array(),
'Bourne Shell' => array(),
'Brainfuck' => array(),
'Brainfuck' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/b/Brainfuck.bf',
),
'C with classes' => array(),
'C++' => array(),
'Caml Light' => array(),
'Clean' => array(),
'Clean' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/c/Clean.icl',
),
'Boo' => array(),
'Cobra' => array(),
'CoffeeScript' => array(),
Expand Down Expand Up @@ -1026,7 +1045,9 @@ function member
'occam 2' => array(),
'EuLisp' => array(),
'Fortran 2018' => array(),
'GDScript' => array(),
'GDScript' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/g/GDScript.gd',
),
'GPSS' => array(),
'Hamilton C shell' => array(),
'Io' => array(),
Expand All @@ -1035,13 +1056,23 @@ function member
'KornShell' => array(),
'LabVIEW' => array(),
'Modula-3' => array(),
'Nemerle' => array(),
'Oberon' => array(),
'Nemerle' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Nemerle/fibonacci-sequence-1.nemerle',
),
'Oberon' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Oberon/fibonacci-sequence.oberon',
),
'Oberon-2' => array(),
'PL/M' => array(),
'PowerBASIC' => array(),
'Pure' => array(),
'PureBasic' => array(),
'PowerBASIC' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/PowerBASIC/fibonacci-sequence.basic',
),
'Pure' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Pure/fibonacci-sequence.pure',
),
'PureBasic' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/PureBasic/fibonacci-sequence-2.basic',
),
'Q' => array(),
'QuickBASIC' => array(),
'REXX' => array(),
Expand All @@ -1050,12 +1081,17 @@ function member
'Speakeasy' => array(),
'Speakeasy-IV' => array(),
'Subtext' => array(),
'Turing' => array(),
'Turing' => array(
'mainRepository' => 'https://github.com/TuringLang',
'rawCodeLink' => 'https://raw.githubusercontent.com/acmeism/RosettaCodeData/refs/heads/main/Task/Fibonacci-sequence/Turing/fibonacci-sequence.turing',
),
'UnrealScript' => array(),
'Visual Basic' => array(),
'Xojo' => array(),
'Z Shell' => array(),
'occam' => array(),
'occam' => array(
'rawCodeLink' => 'https://raw.githubusercontent.com/leachim6/hello-world/refs/heads/main/o/occam.occam',
),
'Dart' => array(),
'Common Lisp' => array(),
'Windows PowerShell' => array(),
Expand Down
24 changes: 21 additions & 3 deletions app/Http/Controllers/MainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,28 @@ public function langHistory() {
}

public function road() {
$road = $this->client->getRoad();

Log::info('action=show_road');

return Inertia::render('Road', $road);
return Inertia::render('Road', array(
'beautifulCode' => FrozenRepository::whereIn('fullName', array(
'biomejs/biome', 'laravel/pint', 'zed-industries/zed',
))->get()->toArray(),
'builtOn' => FrozenRepository::whereIn('fullName', array(
'laravel/laravel', 'vuejs/core', 'sqlite/sqlite', 'inertiajs/inertia', 'nanostores/nanostores',
))->get()->toArray(),
'UiUx' => FrozenRepository::whereIn('fullName', array(
'shoelace-style/webawesome', 'DerYeger/yeger', 'hackernoon/pixel-icon-library',
))->get()->toArray(),
'cleanRepo' => FrozenRepository::whereIn('fullName', array(
'evilmartians/lefthook',
'conventional-changelog/commitlint',
'pestphp/pest',
))->get()->toArray(),
'surprises' => FrozenRepository::whereIn('fullName', array(
'vwh/sqlite-online',
'htzh/leanproved',
'withastro/astro',
))->get()->toArray(),
));
}
}
15 changes: 8 additions & 7 deletions app/Models/GithubApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private function getRepositories(array $tools) {
), $tools);
}

public function getRoad() {
public function getRoad(): array {
$builtOn = $this->getRepositories(
array(
'laravel/laravel', 'vuejs/core', 'sqlite/sqlite', 'inertiajs/inertia', 'nanostores/nanostores',
Expand Down Expand Up @@ -154,12 +154,13 @@ public function getRoad() {
)
);

return array(
'builtOn' => $builtOn,
'beautifulCode' => $beautifulCode,
'UiUx' => $UiUx,
'cleanRepo' => $cleanRepo,
'surprises' => $surprises,
return array_merge(
array(),
$builtOn,
$beautifulCode,
$UiUx,
$cleanRepo,
$surprises,
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void {
Schema::table('frozen_repositories', function (Blueprint $table) {
$table->boolean('forRoad')->default(false);
});
}

/**
* Reverse the migrations.
*/
public function down(): void {
Schema::table('frozen_repositories', function (Blueprint $table) {
$table->dropColumn('forRoad');
});
}
};
15 changes: 12 additions & 3 deletions resources/js/components/prolang/LangCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,21 @@
</span>
</div>

<wa-button slot="footer" variant="brand" pill @click="showCode()">
See details
<wa-button
slot="footer"
variant="brand"
pill
@click="showCode()"
v-if="hasEnoughData"
>
More details
</wa-button>
</wa-card>
</template>

<script lang="ts" setup>
import { codeToHtml } from "shiki"
import { ref } from "vue"
import { computed, ref } from "vue"
import type { ProLangLanguage } from "@/types/main"

const drawerOpen = ref<boolean>(false)
Expand All @@ -91,6 +97,9 @@ const props = defineProps<{
lang: ProLangLanguage
}>()

const hasEnoughData = computed(() => {
return props.lang.link || props.lang.mainRepository
})
const castYears = JSON.parse(props.lang.years).join(", ")

async function setCodeHtml(codeStr: string, lang?: string) {
Expand Down
Loading
Loading