Skip to content

Instantly share code, notes, and snippets.

View MahdiF's full-sized avatar
🍉

Mahdi Farra MahdiF

🍉
View GitHub Profile
@MahdiF
MahdiF / gulpfile.js
Created May 19, 2021 05:08 — forked from LoyEgor/gulpfile.js
best image compression settings (gulp-imagemin)
// install
// npm i gulp-cache gulp-imagemin imagemin-pngquant imagemin-zopfli imagemin-mozjpeg imagemin-giflossy -f
// node node_modules/jpegtran-bin/lib/install.js
// node node_modules/gifsicle/lib/install.js
// node node_modules/zopflipng-bin/lib/install.js
// node node_modules/mozjpeg/lib/install.js
// node node_modules/giflossy/lib/install.js
// node node_modules/pngquant-bin/lib/install.js
@MahdiF
MahdiF / repo-reset.md
Created April 17, 2019 01:44 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A

Keybase proof

I hereby claim:

  • I am mahdif on github.
  • I am mahdif (https://keybase.io/mahdif) on keybase.
  • I have a public key whose fingerprint is 0687 40BB D5BA 004F 4E09 B249 CF2F F958 40A5 E6AB

To claim this, I am signing this object:

checkAudioSupport = function() {
return !!document.createElement('audio').canPlayType;
}
if (checkAudioSupport()){
console.log('Audio is supported');
}
checkShit = function(url) {
var request = new XMLHttpRequest();
request.open('HEAD', url, true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
console.log('it\'s there');
} else {
console.log('it\'s not there');
}