Skip to content

Commit

Permalink
Deploying to gh-pages from @ e90f5f0 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
mo8it committed Oct 17, 2024
0 parents commit ea71ae1
Show file tree
Hide file tree
Showing 35 changed files with 6,451 additions and 0 deletions.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rustlings.cool
245 changes: 245 additions & 0 deletions artifacts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
/* Code modified from the blender website
* https://www.blender.org/wp-content/themes/bthree/assets/js/get_os.js?x82196
*/

let options = {
windows64: "x86_64-pc-windows",
windows32: "i686-pc-windows",
windowsArm: "aarch64-pc-windows",

mac64: "x86_64-apple",
mac32: "i686-apple",
macSilicon: "aarch64-apple",

linux64: "x86_64-unknown-linux",
linux32: "i686-unknown-linux",
linuxArm: "aarch64-unknown-linux",

// ios: "ios",
// android: "linux-android",
// freebsd: "freebsd",
};

function isAppleSilicon() {
try {
var glcontext = document.createElement("canvas").getContext("webgl");
var debugrenderer = glcontext
? glcontext.getExtension("WEBGL_debug_renderer_info")
: null;
var renderername =
(debugrenderer &&
glcontext.getParameter(debugrenderer.UNMASKED_RENDERER_WEBGL)) ||
"";
if (renderername.match(/Apple M/) || renderername.match(/Apple GPU/)) {
return true;
}

return false;
} catch (e) {}
}

function getOS() {
var OS = options.windows64.default;
var userAgent = navigator.userAgent;
var platform = navigator.platform;

if (navigator.appVersion.includes("Win")) {
if (
!userAgent.includes("Windows NT 5.0") &&
!userAgent.includes("Windows NT 5.1") &&
(userAgent.indexOf("Win64") > -1 ||
platform == "Win64" ||
userAgent.indexOf("x86_64") > -1 ||
userAgent.indexOf("x86_64") > -1 ||
userAgent.indexOf("amd64") > -1 ||
userAgent.indexOf("AMD64") > -1 ||
userAgent.indexOf("WOW64") > -1)
) {
OS = options.windows64;
} else {
if (
window.external &&
window.external.getHostEnvironmentValue &&
window.external
.getHostEnvironmentValue("os-architecture")
.includes("ARM64")
) {
OS = options.windowsArm;
} else {
try {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("webgl");

var debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
if (renderer.includes("Qualcomm")) OS = options.windowsArm;
} catch (e) {}
}
}
}

//MacOS, MacOS X, macOS
if (navigator.appVersion.includes("Mac")) {
if (
navigator.userAgent.includes("OS X 10.5") ||
navigator.userAgent.includes("OS X 10.6")
) {
OS = options.mac32;
} else {
OS = options.mac64;

const isSilicon = isAppleSilicon();
if (isSilicon) {
OS = options.macSilicon;
}
}
}

// linux
if (platform.includes("Linux")) {
OS = options.linux64;
// FIXME: Can we find out whether linux 32-bit or ARM are used?
}

// if (
// userAgent.includes("iPad") ||
// userAgent.includes("iPhone") ||
// userAgent.includes("iPod")
// ) {
// OS = options.ios;
// }
// if (platform.toLocaleLowerCase().includes("freebsd")) {
// OS = options.freebsd;
// }

return OS;
}

let os = getOS();
window.os = os;

// Unhide and hydrate selector with events
const archSelect = document.querySelector(".arch-select");
if (archSelect) {
archSelect.classList.remove("hidden");
const selector = document.querySelector("#install-arch-select");
if (selector) {
selector.addEventListener("change", onArchChange);
}
}

// Hydrate tab buttons with events
Array.from(document.querySelectorAll(".install-tab[data-id]")).forEach((tab) => {
tab.addEventListener("click", onTabClick);
});

function onArchChange(evt) {
// Get target
const target = evt.currentTarget.value;
// Find corresponding installer lists
const newContentEl = document.querySelector(`.arch[data-arch=${target}]`);
const oldContentEl = document.querySelector(`.arch[data-arch]:not(.hidden)`);
// Hide old content element (if applicable)
if (oldContentEl) {
oldContentEl.classList.add("hidden");
}
// Show new content element
newContentEl.classList.remove("hidden");
// Show the first tab's content if nothing was selected before
if (newContentEl.querySelectorAll(".install-tab.selected").length === 0) {
const firstContentChild = newContentEl.querySelector(".install-content:first-of-type");
const firstTabChild = newContentEl.querySelector(".install-tab:first-of-type");
firstContentChild.classList.remove("hidden");
if (firstTabChild) {
firstTabChild.classList.add("selected");
}
}
// Hide "no OS detected" message
const noDetectEl = document.querySelector(".no-autodetect");
noDetectEl.classList.add("hidden");
// Hide Mac hint
document.querySelector(".mac-switch").classList.add("hidden");
}

function onTabClick(evt) {
// Get target and ID
const {triple, id} = evt.currentTarget.dataset;
if (triple) {
// Find corresponding content elements
const newContentEl = document.querySelector(`.install-content[data-id="${String(id)}"][data-triple=${triple}]`);
const oldContentEl = document.querySelector(`.install-content[data-triple=${triple}][data-id]:not(.hidden)`);
// Find old tab to unselect
const oldTabEl = document.querySelector(`.install-tab[data-triple=${triple}].selected`);
// Hide old content element
if (oldContentEl && oldTabEl) {
oldContentEl.classList.add("hidden");
oldTabEl.classList.remove("selected");
}

// Unhide new content element
newContentEl.classList.remove("hidden");
// Select new tab element
evt.currentTarget.classList.add("selected");
}
}

const allPlatforms = Array.from(document.querySelectorAll(`.arch[data-arch]`));
let hit = allPlatforms.find(
(a) => {
// Show Intel Mac downloads if no M1 Mac downloads are available
if (
a.attributes["data-arch"].value.includes(options.mac64) &&
os.includes(options.macSilicon) &&
!allPlatforms.find(p => p.attributes["data-arch"].value.includes(options.macSilicon))) {
// Unhide hint
document.querySelector(".mac-switch").classList.remove("hidden");
return true;
}
return a.attributes["data-arch"].value.includes(os);
}
);

if (hit) {
hit.classList.remove("hidden");
const selectEl = document.querySelector("#install-arch-select");
selectEl.value = hit.dataset.arch;
const firstContentChild = hit.querySelector(".install-content:first-of-type");
const firstTabChild = hit.querySelector(".install-tab:first-of-type");
firstContentChild.classList.remove("hidden");
if (firstTabChild) {
firstTabChild.classList.add("selected");
}
} else {
const noDetectEl = document.querySelector(".no-autodetect");
if (noDetectEl) {
const noDetectElDetails = document.querySelector(".no-autodetect-details");
if (noDetectElDetails) {
noDetectElDetails.innerHTML = `We detected you're on ${os} but there don't seem to be installers for that. `
}
noDetectEl.classList.remove("hidden");
}
}

let copyButtons = Array.from(document.querySelectorAll("[data-copy]"));
if (copyButtons.length) {
copyButtons.forEach(function (element) {
element.addEventListener("click", () => {
navigator.clipboard.writeText(element.attributes["data-copy"].value);
});
});
}

// Toggle for pre releases
const checkbox = document.getElementById("show-prereleases");

if (checkbox) {
checkbox.addEventListener("click", () => {
const all = document.getElementsByClassName("pre-release");

if (all) {
for (var item of all) {
item.classList.toggle("hidden");
}
}
});
}
146 changes: 146 additions & 0 deletions changelog/2.2.0/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<!DOCTYPE html>
<html lang="en" id="oranda" class="dark">
<head>
<title>rustlings</title>

<meta property="og:url" content="https://rustlings.cool" />


<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<meta name="description" content="Small exercises to get you used to reading and writing Rust code!" />
<meta property="og:description" content="Small exercises to get you used to reading and writing Rust code!" />

<meta property="og:type" content="website" />
<meta property="og:title" content="rustlings" />



<meta http-equiv="Permissions-Policy" content="interest-cohort=()" />
<link rel="stylesheet" href="/oranda-v0.3.1.css" />


</head>
<body>
<div class="container">
<div class="page-body">

<div class="repo_banner">
<a href="https://github.com/rust-lang/rustlings">
<div class="github-icon" aria-hidden="true"></div>
Check out our GitHub!
</a>
</div>


<main>
<header>

<h1 class="title">rustlings</h1>

<nav class="nav">
<ul>
<li><a href="/">Home</a></li>










<li><a href="/changelog/">Changelog</a></li>

</ul>
</nav>

</header>


<div>
<h1>Rustlings 2.2.0</h1>
<div class="releases-body">


<section class="release ">

<div class="release-info">
<span class="flex items-center gap-2">
<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='currentColor' class='w-6 h-6'>
<path stroke-linecap='round' stroke-linejoin='round' d='M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 005.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 009.568 3z' />
<path stroke-linecap='round' stroke-linejoin='round' d='M6 6h.008v.008H6V6z' /></svg>
2.2.0
</span>
<span class="flex items-center gap-2">

<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='currentColor' class='w-6 h-6'><path stroke-linecap='round' stroke-linejoin='round' d='M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5' /></svg>
Feb 25 2020 at 22:09 UTC

</span>
</div>
<div class="release-body">
<h4>Bug Fixes</h4>
<ul>
<li>Update deps to version compatable with aarch64-pc-windows (#263) (<a href="https://github.com/rust-lang/rustlings/commit/19a93428b3c73d994292671f829bdc8e5b7b3401" rel="noopener noreferrer">19a93428</a>)</li>
<li><strong>docs:</strong>
<ul>
<li>Added a necessary step to Windows installation process (#242) (<a href="https://github.com/rust-lang/rustlings/commit/3906efcd52a004047b460ed548037093de3f523f" rel="noopener noreferrer">3906efcd</a>)</li>
<li>Fixed mangled sentence from book; edited for clarity (#266) (<a href="https://github.com/rust-lang/rustlings/commit/ade52ffb739987287ddd5705944c8777705faed9" rel="noopener noreferrer">ade52ff</a>)</li>
<li>Updated iterators readme to account for iterators4 exercise (#273) (<a href="https://github.com/rust-lang/rustlings/commit/bec8e3a644cbd88db1c73ea5f1d8a364f4a34016" rel="noopener noreferrer">bec8e3a</a>)</li>
</ul>
</li>
<li><strong>installation:</strong> make fatal errors more obvious (#272) (<a href="https://github.com/rust-lang/rustlings/commit/17d0951e66fda8e11b204d5c4c41a0d5e22e78f7" rel="noopener noreferrer">17d0951e</a>)</li>
<li><strong>iterators2:</strong>
<ul>
<li>Remove reference to missing iterators2.rs (#245) (<a href="https://github.com/rust-lang/rustlings/commit/419f7797f294e4ce6a2b883199731b5bde77d262" rel="noopener noreferrer">419f7797</a>)</li>
</ul>
</li>
<li><strong>as_ref_mut:</strong> Enable a test and improve per clippy's suggestion (#256) (<a href="https://github.com/rust-lang/rustlings/commit/dfdf8093ebbd4145864995627b812780de52f902" rel="noopener noreferrer">dfdf809</a>)</li>
<li><strong>tests1:</strong>
<ul>
<li>Change test command (<a href="https://github.com/rust-lang/rustlings/commit/fe10e06c3733ddb4a21e90d09bf79bfe618e97ce" rel="noopener noreferrer">fe10e06c</a></li>
<li>Correct test command in tests1.rs comment (#263) (<a href="https://github.com/rust-lang/rustlings/commit/39fa7ae8b70ad468da49b06f11b2383135a63bcf" rel="noopener noreferrer">39fa7ae</a>)</li>
</ul>
</li>
</ul>
<h4>Features</h4>
<ul>
<li>Add variables5.rs exercise (#264) (<a href="https://github.com/rust-lang/rustlings/commit/0c73609e6f2311295e95d6f96f8c747cfc4cba03" rel="noopener noreferrer">0c73609e</a>)</li>
<li>Show a completion message when watching (#253) (<a href="https://github.com/rust-lang/rustlings/commit/d25ee55a3205882d35782e370af855051b39c58c" rel="noopener noreferrer">d25ee55a</a>)</li>
<li>Add type conversion and parsing exercises (#249) (<a href="https://github.com/rust-lang/rustlings/commit/0c85dc1193978b5165491b99cc4922caf8d14a65" rel="noopener noreferrer">0c85dc11</a>)</li>
<li>Created consistent money unit (#258) (<a href="https://github.com/rust-lang/rustlings/commit/fd57f8f2c1da2af8ddbebbccec214e6f40f4dbab" rel="noopener noreferrer">fd57f8f</a>)</li>
<li>Enable test for exercise test4 (#276) (<a href="https://github.com/rust-lang/rustlings/commit/8b971ffab6079a706ac925f5917f987932b55c07" rel="noopener noreferrer">8b971ff</a>)</li>
<li>Added traits exercises (#274 but specifically #216, which originally added
this :heart:) (<a href="https://github.com/rust-lang/rustlings/commit/b559cdd73f32c0d0cfc1feda39f82b3e3583df17" rel="noopener noreferrer">b559cdd</a>)</li>
</ul>
<p><a rel="noopener noreferrer"></a></p>

</div>
</section>
</div>
</div>

</main>
</div>

<footer>

<a href="https://github.com/rust-lang/rustlings"><div class="github-icon" aria-hidden="true"></div></a>

<span>
rustlings, MIT
</span>
</footer>
</div>


<script defer="true" data-domain="rustlings.cool" src="https://plausible.io/js/script.js"></script>




</body>
</html>
Loading

0 comments on commit ea71ae1

Please sign in to comment.