Ruby was made by someone tired of losing code golf challenges so they made Ruby so they could win
Exactly, lol but I think it was also one with a 30 second time-limit, ngl
TIL Ruby was named because the creator didn’t know whether to name it Coral or Ruby, but chose Ruby because it was the birthstone of one of his colleagues.
JavaScript for games is the Minecraft enchantment table script of “game languages”
A line of JS in games looks like this
if (this.THIS.ThIs(())["keyed"] == x.XrV.this.data(func{alert("this is not even the weirdest example if JS"); //NOTE: WE NEED TO MAKE IT SLOWER)})) {
alert("refedfjejdjfjdidbddn")
}
source: I made a game ~1 year ago in raw HTML and JS. I haven’t been able to sleep since.
Most sane piece of JS code
lol, that’s what happens when you don’t follow good naming conventions. Also I don’t think that should work?
JS works in mysterious ways. I’m sure on one person’s computer, it would work, and on another’s somehow delete sys32.
lol, but one of the points of JS is that it works almost exactly the same on all devices because the browser takes care of making sure everything works fine. Also not possible for browser JS to access files without a user specifically selecting the file in the first place.
That is probably true (I don’t know js), but a big point for python is that even though it requires an insane amount of work and memory, it’s technically possible to do many things possible in js
Yeah, same with Java and any other language run via a virtual machine/whatever you call it
yeah, thing is that it requires so much work that I sometimes wish I knew JS, but I’m too lazy so XD
What requires so much work?
oh just literally setting up any type of python server
For JS you can do something like:
// setup express server
const express = require("express");
const app = express();
const server = require("http").createServer(app);
// host a static folder
app.use(express.static(__dirname + "/public"));
// handle a get request to host
app.get("/", function(req, res) {
res.sendFile(__dirname + "/file.html");
});
// handle a post request to /api
app.post("/api", function(req, res) {
res.send('{ "message": "This API does not exist!" }');
});
// handle 404
app.use(function(req, res, next) {
res.sendFile(__dirname + "/404.html");
});
// start server
server.listen(8080);
What’s Python like?
oh, honestly… wait it’s actually not that much harder:
from flask import Flask, render_template, send_file
app = Flask(__name__)
@app.route('/')
def homepage():
return render_template("index.html")
@app.route('/api')
def get_file():
return { "message": "This API does not exist!" }
app.run("0.0.0.0")
Personally, I always prefer to do stuff myself, I avoid libraries at all costs.
Me too. I only really use libraries for python, and even then that’s just the basic ones like Random and Colorama. The only other libraries I use are imports from my other .py files to make the program faster.
Why use js when you can use a better language that compiles to js.