Skip to content

Instantly share code, notes, and snippets.

View majidzeno's full-sized avatar
☀️

Majid Eltayeb majidzeno

☀️
View GitHub Profile
// JS Code
// Libraries used to run slick carousel
// 1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// 2. https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick.min.js
const link1 = document.createElement('link');
link1.rel = 'stylesheet';
link1.type = 'text/css';
link1.href = 'https://cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css';
@majidzeno
majidzeno / cloudSettings
Last active May 19, 2020 15:19
mj-vsCodeSetting
{"lastUpload":"2020-05-19T15:19:10.024Z","extensionVersion":"v3.4.3"}
@majidzeno
majidzeno / Fibonacci.txt
Last active July 24, 2018 21:34
Fibonnaci
// Fibonacci Function ( Recursion Case) (Very bad time complexity , very slow , the browser crash if you inter index of 50)
function fibonacci(position) {
if (position < 3) {
return 1;
} else {
return fibonacci(position - 1) + fibonacci(position - 2);
}
}
fibonacci(6);
@majidzeno
majidzeno / Sass Configuration
Created July 20, 2018 21:14
Configuring Sass With Create-react-app tool
- Create a new folder "styles" inside "src" folder
- create 2 folders inside styles "scss" & "css"
- move all the files of the starter project inside "scss" and rename their extension to be .scss
- edit "index.js" to get the correct url for the index.css file
- remove "App.css" from "App.js" file
- edit package.json "scripts" object
"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/styles/scss/index.scss -o src/styles/css/",
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/styles/scss/index.scss -o src/styles/css/ --watch --recursive",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
@majidzeno
majidzeno / gist:2aac8b9290ffe97fe418b673c07f8820
Created June 25, 2018 21:03
A great explanation to how to bind events to the DOM elements after adding them dynamically
https://elliotekj.com/2016/11/05/jquery-to-pure-js-event-listeners-on-dynamically-created-elements/
-- Git --
Learn Enough Git to Be Dangerous: https://www.learnenough.com/git-tutorial
@majidzeno
majidzeno / gist:22b865eb8a6b460d8c61f9a2d6cc85c4
Last active June 22, 2018 03:46
Using the "~" with "indexOf" function
if(~x.indexOf('a')){alert('found it ')}else{alert('bad luck mate :( ')};
use ~ instead of relying on the result of indexOf if it -1 or not to tell if this string have the search item or not
where x is a string
@majidzeno
majidzeno / gist:50596a072568e4763cbaad4f9274e8de
Created November 5, 2017 18:32
Using Foundation Zurb 6 with browsersync.io for static website
--> First in terminal, navigate to your project folder and run the following command:
$ npm install browser-sync gulp --save-dev
--> then open gulp.js and copy the following :
gulp.task('default', ['sass'], function() {
gulp.watch(['scss/**/*.scss'], ['sass']);
});
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
@majidzeno
majidzeno / gist:ef3b978d1a4f2fa082956bb5e225c06d
Last active November 5, 2017 19:04
npm issues and how i fixed it
$ npm install....
//an error occured
> [email protected] postinstall /Applications/XAMPP/xamppfiles/htdocs/myproject/wp-content/themes/Foundationpress
> bower install && gulp build
module.js:474
throw err;
^
Error: Cannot find module 'internal/fs'