Linkchecker with pure Nodejs

18/12/19 13:50:23

I wanted to create a linkchecker that only reads the links that i created meaning no cdn links or google analytics and i didnt want to ddos the web server since i wanted to run the linkchecker on multiple websites from the same server

If you are interested check the following links

On gist you need to run it with node like this:

node linkchecker.js https:://
Gist Link
On github u can mark it as executable and run it(linux)
chmod +x linkchecker
mv linkchecker /usr/local/bin

Github Link

Jquery selector with pure javascript

06/11/19 09:05:21

The only thing i wanted on pure js from jquery was the selector and my code not to break everytime a div is missing when i am adding events or using them on something.

So after a long search on the Internet i couldn't find anything other the selector...

So i figured out one way is to make a fake element if the real one does not exist.

The fake one is never placed on the html and every event on the fake element will get ignored!

Unless you are having "unknown" elements you should never have any issues :)

//jquery selector 
//using '$' will select 1 item
//and using $$ will select all items
function $(s) {
  //if doesn't exist throw a fake element to ignore all errors
  return (!document.querySelector(s)) ? document.createElement("unknown") : document.querySelector(s);
function $$(s) {
  //same logic as $
  return (!document.querySelectorAll(s)) ? document.createElement("unknown") : document.querySelectorAll(s);
//add events using this $(example).on("click",function(){});
Object.prototype.on = function(name, fn) {
  //don't create the event if element is unknown
  return (this.tagName.toLowerCase() !== "unknown") ? this.addEventListener(name, fn) : false;

Now if there is no element with that name the whole js won't break!

Using $ will always search for 1 element for more u have to use $$

We all have problems with mobile debuging

20/07/19 10:57:38

I couldn't find anything better for webpage debugging tool without using a USB...

So i was using a div all the time on the HTML...

I don't know if this is the best way but since it doesn't hurt the project and it doesn't give bad results i published it in NPM

Hope it helps other people as it did for me :)

Github link

NPM link

Apache configuration to allowing only specific ips to enter in drupal's control panel

04/11/18 17:07:01

This will run recursively for user path

<LocationMatch "/user">
 Order deny,allow
 deny from all
 allow from [YOURIP]

And this will throw 404 Drupal stupid /?q=user path...

RewriteEngine on
RewriteCond %{QUERY_STRING} ^(.*)?q=user(.*)$
RewriteRule ^ - [L,R=404]

I made a mini web app with pure nodejs for tinkerboard

01/09/18 08:14:14

It should work fine for raspberry and other Debian based Linux!

The app shows tinkerboard's status (temp,cpu usage,ram usage,packages to update)

I made a lot of comments explaining how it works so i hope its easy for someone to get to know nodejs or how http works without any framework.

Visit Git Repo