Skip to content

Instantly share code, notes, and snippets.

View supahfunk's full-sized avatar

Supah supahfunk

View GitHub Profile
@supahfunk
supahfunk / 0_reuse_code.js
Created June 9, 2014 10:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@supahfunk
supahfunk / gulpfile.json
Created May 17, 2018 06:47
Optimize images
const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
const imageminJpegRecompress = require('imagemin-jpeg-recompress');
const imageminPngQuant = require ('imagemin-pngquant');
gulp.task('min', () =>
gulp.src('originali/*')
.pipe(imagemin())
.pipe(gulp.dest('min'))
);
@supahfunk
supahfunk / image-mask-reveal-animation-v-2.markdown
Last active December 17, 2020 11:59
Image Mask Reveal Animation v.2
@supahfunk
supahfunk / index.html
Created June 24, 2018 11:18
Split Slick Slideshow
<!--
Follow me on
Dribbble: https://dribbble.com/supahfunk
Twitter: https://twitter.com/supahfunk
Codepen: https://codepen.io/supah/
-->
<div class="split-slideshow">
<div class="slideshow">
@supahfunk
supahfunk / smoothscrollbar.js
Created August 3, 2018 10:19
Smooth scrollbar per Chrome
function init() { if (!document.body) return; var e = document.body; var t = document.documentElement; var n = window.innerHeight; var r = e.scrollHeight; root = document.compatMode.indexOf("CSS") >= 0 ? t : e; activeElement = e; initdone = true; if (top != self) { frame = true } else if (r > n && (e.offsetHeight <= n || t.offsetHeight <= n)) { var i = false; var s = function () { if (!i && t.scrollHeight != document.height) { i = true; setTimeout(function () { t.style.height = document.height + "px"; i = false }, 500) } }; t.style.height = ""; setTimeout(s, 10); addEvent("DOMNodeInserted", s); addEvent("DOMNodeRemoved", s); if (root.offsetHeight <= n) { var o = document.createElement("div"); o.style.clear = "both"; e.appendChild(o) } } if (document.URL.indexOf("mail.google.com") > -1) { var u = document.createElement("style"); u.innerHTML = ".iu { visibility: hidden }"; (document.getElementsByTagName("head")[0] || t).appendChild(u) } if (!fixedback && !disabled) { e.style.backgroundAttachment = "scroll"; t.s
@supahfunk
supahfunk / color-gradient.js
Created September 17, 2018 14:37
Making colour gradients
// From https://stackoverflow.com/a/13542669
// Made by Monica Dinculescu
// These are the magical methods!
/*
* Darkening/Lightening. Params:
* - a color in an rgb format, ex rgb(123,123,123).
* - a percent, which means how much to darken/lighten the colour.
* If the percent is positive, you're lightening. Otherwise, it's darkening.
*
@supahfunk
supahfunk / cloudSettings
Last active February 10, 2020 09:31
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-02-10T09:31:00.287Z","extensionVersion":"v3.4.3"}
@supahfunk
supahfunk / browser-detect.js
Created September 28, 2018 13:08
Browser detect
var is_chrome = navigator.userAgent.indexOf('Chrome') > -1;
var is_explorer = navigator.userAgent.indexOf('MSIE') > -1;
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
var is_safari = navigator.userAgent.indexOf("Safari") > -1;
var is_opera = navigator.userAgent.toLowerCase().indexOf("op") > -1;
if ((is_chrome)&&(is_safari)) { is_safari = false; }
if ((is_chrome)&&(is_opera)) { is_chrome = false; }
@supahfunk
supahfunk / smooth-scroll.js
Created April 18, 2019 15:22
Smooth Scrollbar for websites
(function(){
// Scroll Variables (tweakable)
var defaultOptions = {
// Scrolling Core
frameRate : 150, // [Hz]
animationTime : 400, // [px]
stepSize : 120, // [px]
// Pulse (less tweakable)
// Ratio of "tail" to "acceleration"
const scale = (a, b, c, d, e) => {
return (a - b) * (e - d) / (c - b) + d
}