Skip to content

Instantly share code, notes, and snippets.

View Simsso's full-sized avatar

Timo Denk Simsso

View GitHub Profile
@Simsso
Simsso / map.js
Created May 10, 2016 09:05
Maps a value from an input to an output boundary
function map(x, inMin, inMax, outMin, outMax) {
return (x-inMin) * (outMax-outMin) / (inMax-inMin) + outMin;
}
@Simsso
Simsso / bootstrap-accordion-toggle-events.js
Last active May 10, 2016 09:07
Changes the class of a Bootstrap accordion panel (.panel) depending on it's state (either collapsed or expanded)
$('.panel').on('hidden.bs.collapse', function () {
$(this).addClass('collapsed');
}).on('show.bs.collapse', function () {
$(this).removeClass('collapsed');
});
@Simsso
Simsso / min-and-max-width.css
Created May 6, 2016 08:35
Bootstrap Grid CSS Media Queries
/* Extra small devices only (phones, less than 768px) */
@media (max-width: 767px) { ... }
/* Small devices only (tablets, @screen-sm-min) */
@media (min-width: 768px) and (max-width: 991px) { ... }
/* Medium devices only (desktops, @screen-md-min) */
@media (min-width: 992px) and (max-width: 1199px) { ... }
/* Large devices only (large desktops, @screen-lg-min) */