We all have problems with mobile debuging

3 months ago

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 config for allowing only specific ips from control panel for drupal

a year ago

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

a year ago

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.

Click For The Repo

SQLite Database update on file change

a year ago

Here is how i use SQLite to grab new data on file change before someone calls it(from the routes).

I use this on express js you can set it up on app.js.

All the database will be stored into one variable and you can use javascript commands to manage/filter/split whatever you want as long as you don't want to access the db for adding or do any other stuff with it.

var Database = require('better-sqlite3'),
    db = new Database('./data/db.db'),
    database = [];

function data(){
   database = db.prepare('SELECT * FROM items').all;


  console.log(`There was a ${s} in the database`);

Just to be safe it's always nice to have these options on

db = new Database('data.db',{readonly:true,fileMustExist: true})

{readonly: true} blocks SQLite commands from executing like `insert`

{fileMustExist: true} throws error if you mess up with the location of the database instead of creating a new one

How to use universal-analytics with express

a year ago

Just place this inside the app.js

Before you call the routes middleware

var ua = require('universal-analytics');
dp: req.url,
dh: req.headers.host,
uip: req.headers['x-forwarded-for'] || req.connection.remoteAddress,
ua: req.headers['user-agent'],
dr: req.headers.referrer || req.headers.referer,
de: req.headers['accept-encoding'],
ul: req.headers['accept-language']