Skip to content

Instantly share code, notes, and snippets.

View thedineshj's full-sized avatar

Din Esh thedineshj

View GitHub Profile
@thedineshj
thedineshj / SessionManager.php
Last active October 15, 2018 22:00
Php class for maintaining sessions over some days
<?php
class SessionManager{
/*
SETTINGS FOR OUR SESSION
SESSION_NAME - Name of our session
ACTIVE_DAYS - Number of days you want the session to be active
*/
public const SETTINGS=[
@thedineshj
thedineshj / remove.js
Created September 15, 2018 15:11
How to remove 'Powered by 000webhost' image from your freely hosted site on 000webhost
window.onload = () => {
let el = document.querySelector('[alt="www.000webhost.com"]').parentNode.parentNode;
el.parentNode.removeChild(el);
}
@thedineshj
thedineshj / localStorageIsSuppoorted.js
Created September 12, 2018 20:14
Check is the browser supports local storage
function localStorageIsSupported() {
  return (typeof(Storage) !== "undefined" && typeof(localStorage) !== "undefined");
}
//console.log(localStorageIsSupported());
<?php
// Example 1
$arr=array(
"language"=>"en-US",
"theme"=>array(
"color"=>"blue",
"font-size"=>24
)
);
$allowedColors=["blue","green","yellow"];
<?php
class Database{
protected $mysqli=null;
public function connect(){
$this->mysqli = new mysqli("127.0.0.1","root","root","dbname",3306);
if ($this->mysqli->connect_error) {
return [FALSE,$this->mysqli->connect_error];
}
else {
return [TRUE,"Connected"];
class node {
constructor(data) {
this.data = data;
this.next = null;
}
}
class SingleLinkedList {
getSize() {
console.log(this.length);
}
delete(value) {
/*
if the list is empty
*/
if (this.head == null) {
console.log("The list is empty");
}
/*
Traverse through list recursively
*/
search(value) {
/*
if the list is empty
*/
if (this.head == null) {
console.log("The list is empty");
return false;
}
/*
Traverse through list recursively
display() {
/*
if list is empty
*/
if (this.head == null) {
console.log('List is empty');
}
/*
Traverse through the list
recursively until `currentnode`