Skip to content
Sign UpLog In
Profile icon

Gav Hern

@GavHern
I make websites and maybe more
Repls
Community
GavHern
GavHern
shared a Post
2 years ago
PHP - Make all requests to certain directory point to one PHP file
I know it makes more sense to do this in nodejs or something else, but my project is in PHP and I want to know if there's a way to do this in PHP. sa
GavHern
GavHern
I've found a solution now if you have apache. Make a .htaccess and put RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?dir=$1 [L,QSA] This will run index.php and pass the path of the request as the dir parameter.2 years ago
Whacko
Whacko
Hmmmmm... I just don't think there's a way for PHP. Although maybe in a node.js repl.2 years ago
Highwayman
Highwayman
Just make the entire hunk page a redirect script, or use node js + node-php2 years ago
GavHern
GavHern
shared a Post
2 years ago
I've explored several ways to add elements to the document with Javascript, but they all seem very clunky and unorganized... I'm trying to add compli
ironblockhd
ironblockhd
Maybe bad practice, idk let wrap = document.createElement("div"); wrap.innerHTML = "some html" element.appendChild(wrap)2 years ago
SixBeeps
SixBeeps
Usually, I'll make a template (either in a string or in its own file) and fill in dummy values with replace(). Then, you can use the innerHTML method with the filled-in template. If you're having issues with event listeners breaking, I might even give each one its own ID and apply the listener on creation.2 years ago
GavHern
GavHern
shared a Post
2 years ago
I'm trying to find how to get the current timestamp using javascript. Not the Unix Epoch timestamp (as in seconds elapsed since Jan 1, 1970) but a tim
topkekmabel
topkekmabel
var d = new Date(); to create a new Date() object d.toISOString() to get it in your preffered format or just: (new Date()).toISOString()2 years ago
TheForArkLD
TheForArkLD
(new Date()).toString() or (new Date()).toISOString() `2 years ago
GavHern
GavHern
shared a Post
2 years ago
I have a discord bot and i want to keep it always running... I have it on uptimerobot set to every 5 minutes but for some reason, my bot goes offline
Buhron
Buhron
Use the live running Node.js template7 months ago
bzzt
bzzt
Use cron-job.org, you can set unlimited 1-minute cron jobs.2 years ago
TheForArkLD
TheForArkLD
Ping every 5minutes probably this will works2 years ago
GavHern
GavHern
shared a Post
3 years ago
Say I wanted to make a text chat. Would there be a way that I could tell the frontend that there are new messages without the frontend having to conti
abc3354
abc3354
Hi ! You can use websockets with the socket.io lib for example (socket.io is for node.js). You will be able to find good tutorials online for this specific subject. Asking the community is fine and I'm happy to answer you, but do not forget google ;) > If you found my answer helpful, you can upvote it :) > Please, do not hesitate to ask in comments if you have any problems 3 years ago
GavHern
GavHern
shared a Post
3 years ago
I'm trying to make it so that, for example, if there is a link to http://www.example.com or an image linked to http://www.example.com/logo.png, I can
RohilPatel
RohilPatel
Yes, you sure can! All you need is the "post" method. Make a html form with a action to the file, and add the inputs by name as follows: Hey, my name is Try it and see!3 years ago
GavHern
GavHern
shared a Post
3 years ago
I'd like to be able to add a number of hours to a date. For example: (1/15/2020 3:00PM) + 2 hours = (1/15/2020 5:00PM) The issue I have is getting a
Keaneob
Keaneob
Oh ik date(g) : Date(i)2 years ago
GavHern
GavHern
shared a Post
3 years ago
I just got hacker plan and I'm wondering something about private repls. If I have a repl that has a repl.co URL (like an HTML, PHP Web Server, things
owisalaa
owisalaa
HOW Get access to Private repls9 months ago
owisalaa
owisalaa
HOW TO GET ACSSESS 9 months ago
HackermonDev
HackermonDev
Enjoy your 90 days hacker plan ( if you got it from the coupon )3 years ago
GavHern
GavHern
shared a Post
3 years ago
I came accross this: fetch('URL') .then(res => res.json()) .then((data) => console.log(data)) and it works great! I just have no idea ho
Vandesm14
Vandesm14
What you have is something called an async function. A .then function is executed once the asynchronous function is finished and returns a promise. In order to store the JSON to a variable, you'd need to do something like this: var myVariable; console.log(myVariable) // undefined fetch('URL') .then(res => res.json()) .then((data) => {myVariable = data}) console.log(myVariable) // undefined /* FUNCTION IS FINISHED */ console.log(myVariable) // response json If you try to call the 3 years ago
GavHern
GavHern
shared a Post
3 years ago
Whenever I make a change I get these two popups... image I just wanted to ask if anyone has similar issues. It's been going on for two days now. If
theangryepicbanana
theangryepicbanana
Are you an explorer (the role)?3 years ago
GavHern
GavHern
shared a Post
3 years ago
On my website, I have a transparent color for my navigation bar background. image Recently, I discovered the backdrop-filer css rule and wanted to a
hyperupcall
hyperupcall
hey! one workaround is creating a wrapper div around the elements in your navbar, and absolutely positioning its children. for example, the following structure music> projects could be styled similar to the following #wrapper { position: relative; width: 100%; height: 50px; } #transparent-block { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: black; opacity: 0.5; } #navigation-bar { position: absolute;3 years ago
GavHern
GavHern
shared a Post
3 years ago
I'm making a friend's website and I have an ` tag to link to a page about a game he's making. I also have a inside that tag to download the game. Si
JackLee7
JackLee7
Add a event listener for the button and use event.stopPropogation(). Let me know if you need help wth this!3 years ago
GavHern
GavHern
shared a Post
3 years ago
I'm wondering how sites like Soundcloud are able to keep an element there no matter what page the user is on. (In Soundcloud's case, the audio player.
vedprad1
vedprad1
I do not know exactly how that happens, but something you can do is make the component in an external window. It does not work exactly like how you probably want it, but that's what I would do. window.open('https://repl.it/talk/ask/How-do-you-keep-an-element-on-screen-when-the-user-navigates-off-the-page/17042', 'ext', 'height=300,width=300', false); `3 years ago
mwilki7
mwilki7
My guess is it copies the html data or whatever object data is there before page transition and hands it off to the next page to load it.3 years ago
GavHern
GavHern
shared a Post
3 years ago
I have a bit of a tricky scenario. I want to select all of the children of and id #navbar that are ` tags. I also don't want to select the children wi
ArchieMaclean
ArchieMaclean
You could use querySelectorAll, like: document.querySelectorAll('#navbar a:not(#logoid)'); That returns a NodeList which you can convert to an array using es6 notation: [...document.querySelectorAll('#navbar a:not(#logoid)')] If you only want the first instance of a tag matching the query, you can using querySelector like: document.querySelector('#navbar a:not(#logoid)'); // returns first match Please mark this as the answer if it solved your problem :)3 years ago
GavHern
GavHern
shared a Post
4 years ago
I tried updating my site to use an .htaccess file to remove the .html file extension from the URL. This did not work and I'm just getting the replit 4
bzzt
bzzt
If there are still people who are wondering how to achieve this, it now is possible to use an htaccess file with a static HTML,CSS,JS project. Here's the code I used to redirect all .html links to static endpoints: RewriteCond %{THE_REQUEST} \.html RewriteRule ^(.*)\.html$ /$1 [R=301,L] `1 year ago
smuppana060
smuppana060
This question is old but for any future users looking to do this - You do not have to use .htaccess files. You can just create a folder with your desired name and place into it an index.html3 years ago
a5rocks
a5rocks
I mean, I would just code a simple backend. Flask or express or whatever. But yeah, repl should add .htaccess working. (idk if your code is wrong btw)4 years ago
GavHern
GavHern
shared a Post
4 years ago
Hey, Everyone! I made a Google Chrome extension to quickly create new repls, no matter what page you're on! While I did initially make this for perso
Buhron
Buhron
And secondly, "tkinter" is not a official language.7 months ago
Buhron
Buhron
Node.js is not JavaScript. It is a different language. When i click Node.js it does the same thing7 months ago
Buhron
Buhron
This link directs you to the same link it is here.8 months ago
GavHern
GavHern
shared a Post
4 years ago
I was trying to do the Fibonacci sequence code in as little lines as I could and realized this could be an interesting challenge. Take simple beginner
a5rocks
a5rocks
Lines or characters? Since one-lining things are pretty easy so long as they don't have an infinite loop. (e.g. https://github.com/A5rocks/april-fools-bot) Also, fibonacci sequence: a,b=1,1 while True:a,b=(lambda _:(b,a+b))(input(a)) Without too much optimization4 years ago
GavHern
GavHern
Here's the fibonacci sequence code I made: https://repl.it/@GavHern/Fibonacci-little-lines4 years ago
GavHern
GavHern
shared a Post
4 years ago
How do some libraries like random or time become "default"? Why is it that you don't need time.py or random.py in your project? Is it possible to make
a5rocks
a5rocks
So, python has a package manager called pip. It uses its own folder which it stores all the modules in, and python just loads from the folder. You can let people download your module by putting it on https://pypi.org/4 years ago
GavHern
GavHern
shared a Post
4 years ago
I know a lot of languages for console apps but I want to expand to making actual applications with UIs and whatnot. My main goal is to make it look cl
ashleyo
ashleyo
You don't make it too clear what your goals/background are, but for Windows some options Use Python, learn Tkinter Use .NET and eg C#, learn WPF (modern) or WindowsForms (legacy, but a slightly less steep learning curve) If you are really a command line warrior ... you can write Powershell scripts that have GUI interfaces, Powershell is OO and .NET aware, nothing to stop you doing something like ... [reflection.assembly]::loadwithpartialname(“System.Windows.Forms”) | Out-Null $MyForm = New-Obj4 years ago
MATTHEWBECHTEL
MATTHEWBECHTEL
Compatible* sorry but I need you to correct your spelling lol.4 years ago
TheDrone7
TheDrone7
That's a good thing, but it all comes down to which languages are you already familiar with? Would you like to use them for the purpose or are you open to suggestiong from any language?4 years ago