Skip to content

Instantly share code, notes, and snippets.

Avatar

Mohcin Bounouara MohcinBN

View GitHub Profile
@MohcinBN
MohcinBN / EvenNumbersInArray.php
Last active May 18, 2022
Find Numbers with Even Number of Digits
View EvenNumbersInArray.php
<?php
$nums = [6, 12];
function findNumbers($nums) {
// initialise the count
$count = 0;
foreach($nums as $num){
$numLenght = strlen($num);
View csvToXml.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$csv = [];
if ($_FILES['csv']['error'] == 0) {
$name = $_FILES['csv']['name'];
$ext = strtolower(end(explode('.', $_FILES['csv']['name'])));
@MohcinBN
MohcinBN / csvToXml.hmtl
Created May 18, 2022
CSV TO XML using PHP, Ajax
View csvToXml.hmtl
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>SCV To XML</title>
@MohcinBN
MohcinBN / promise.js
Created Sep 25, 2020
JavaScript promise example
View promise.js
const myPromise = new Promise((resolve, reject) => {
let connection = false;
if (connection) {
resolve('Conection is OK');
} else {
reject('conection is not OK')
}
});
@MohcinBN
MohcinBN / Galaxy-5-target.css
Last active May 6, 2021
Galaxy 5 640x360 resolution target CSS
View Galaxy-5-target.css
@media only screen and (max-width: 640px) and (orientation : landscape) {
//your code here
}
@MohcinBN
MohcinBN / vue-image-slide.js
Created Jan 6, 2021
Vue Js Images Slide easy to understand, based on existing example on the net I just Develop and simplify it it a little
View vue-image-slide.js
<!-- HTML -->
<div id="app">
<a @click.prevent="prevSlide()" href="#" id="prev-slide"
><i class="fas fa-chevron-right"></i
></a>
<a @click.prevent="nextSlide()" href="#" id="next-slide"
><i class="fas fa-chevron-left"></i
></a>
<div class="col-md-12 p-0 slide">
<div v-for="slide in [currentSlider]" :key="slide.id">
View text_to_downlable_image.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Text To Downloadable Image</title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
@MohcinBN
MohcinBN / show-hide-password.html
Last active May 6, 2021
Vue Js Hide/Show Password
View show-hide-password.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Show/hide Password</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.js"></script>
</head>
<body>
@MohcinBN
MohcinBN / showdivfull
Last active Oct 8, 2018
Jquery Click to show div 100%, with css animation
View showdivfull
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
<style>
.text {width: 40%; background: red;}
.back {display:none;}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>