Skip to content

Instantly share code, notes, and snippets.

View mtaraabi's full-sized avatar

Mohammad Alaraabi mtaraabi

View GitHub Profile
@mtaraabi
mtaraabi / active-class-php.php
Created February 23, 2020 23:26
Add class=“active” to active page using PHP #php
//header.php
$activePage = basename($_SERVER['PHP_SELF'], ".php");
//nav.php
<ul>
<li class="<?= ($activePage == 'index') ? 'active':''; ?>"><a href="/index.php">Home</a></li>
<li class="<?= ($activePage == 'tutorials') ? 'active':''; ?>"><a href="/tutorials.php">Tutorials</a></li>
@mtaraabi
mtaraabi / upload.php
Last active February 16, 2020 11:01
upload img php #php
if (isset($_FILES['userfile'])) {
move_uploaded_file($_FILES['userfile']['tmp_name'], '../main-img/maps/' . $_FILES['userfile']['name'] );
$att_map = 'main-img/maps/' . $_FILES['userfile']['name'];
}
<div class="form-group col-md-6">
@mtaraabi
mtaraabi / php mysql last id.php
Created February 7, 2020 01:47
php mysql last id
$att_id_working = mysqli_insert_id($connection);
@mtaraabi
mtaraabi / intro.php
Created October 24, 2018 15:23
ci intro
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome_message');
}
}
@mtaraabi
mtaraabi / mysql.sql
Last active August 13, 2018 14:33
myqsl
// auto increament reset
ALTER TABLE table_name AUTO_INCREMENT = 1;
SELECT country.name AS country, city.name AS city FROM country JOIN city ON country.capital_city_id = city.id
@mtaraabi
mtaraabi / nav-ion.ts
Created July 23, 2018 23:33
Nav Ionic
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(private navCtrl: NavController) {
@mtaraabi
mtaraabi / hello-world-ionic.ts
Last active July 23, 2018 01:18
hello world ionic
<ion-header>
<ion-navbar color="secondary">
<ion-title>
Hello Darling
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-item>
if (typeof React === 'undefined') ! function(t) {
if ("object" == typeof exports && "undefined" != typeof module) module.exports = t();
else if ("function" == typeof define && define.amd) define([], t);
else {
var e;
e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, e.React = t()
}
}(function() {
return function t(e, n, r) {
function o(a, u) {
@mtaraabi
mtaraabi / style.css
Last active June 24, 2018 13:11
img full screen
body, html {
/* img cover all page */
height: 100%;
/* margin padding to Zero*/
margin: 0;
padding: 0;
}
.bgimg {
/* bg image */
@mtaraabi
mtaraabi / counter.js
Created June 24, 2018 10:27
Coming Soon Counter
//set date for count down
var countDownDate = new Date("Dec 31, 2018 00:00:00").getTime();
// update the counter down every 1 sec
var countDownFunction = setInterval(function(){
// get today date
var now = new Date().getTime();
// find distance btw now and countdown Date
var distance = countDownDate - now ;
// time calc for days, hours , minutes and seconds
var days = Math.floor(distance /(1000 * 60 * 60 * 24));