Skip to content

Instantly share code, notes, and snippets.

View theJinxrat's full-sized avatar

theJinxrat

View GitHub Profile
@theJinxrat
theJinxrat / CaesarCipher.php
Created February 5, 2021 12:43
Caesar Cipher Encode Decode (PHP)
<?php
function CaesarCipherDecode($string, $casas = 9) {
$abc = range('a', 'z');
$decifrado = '';
foreach (str_split(strtolower($string)) as $letter) {
if (ctype_alpha($letter)) {
foreach ($abc as $key => $alpha) {
if ($letter === $alpha) {
if (($key - $casas) < 0) {
$decifrado .= $abc[(($key - $casas) + count($abc))];
@theJinxrat
theJinxrat / ship.html
Last active March 8, 2021 21:28
Resolvi reescrever, agora em Javascript, uma antiga página que criei pra passar o tempo. A ideia era somente criar automaticamente "ships" com nomes: https://xg1.com.br/love
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shippr</title>
<style>
* {
box-sizing: border-box;
@theJinxrat
theJinxrat / rss2json.vanilla.js
Created March 8, 2021 21:26
Parse RSS file to JSON with Vanilla JS
const items = []
fetch('https://example.com/feed.xml')
.then(res => res.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(data => {
data.querySelectorAll("item").forEach((item, idx) => {
const obj = {}
Array.from(item.children).map(v => obj[v.tagName] = v.textContent)
items[idx] = obj
})