Skip to content

Instantly share code, notes, and snippets.

View MarioSo's full-sized avatar
✌️
Hi, there! sup?

Mario Sommer MarioSo

✌️
Hi, there! sup?
View GitHub Profile
@MarioSo
MarioSo / _vh.scss
Last active January 14, 2020 14:53
Little helper mixin to make 100vh less painfull on mobile - more info here: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
@function vh($vh) {
@return calc(var(--vh, 1vh) * #{$vh});
}
@mixin vh($vh, $prop: height) {
#{$prop}: $vh * 1vh;
#{$prop}: vh($vh);
}
@MarioSo
MarioSo / wall-of-text.vue
Created June 12, 2019 12:37
Wall of Text vue component by URSA MAJOR SUPERCLUSTER
<script>
import { TimelineMax, Power0, Power3 } from 'gsap'
import { find, hasClass } from '../scripts/elements'
import { addListener } from '../scripts/events'
import SpanOrBreak from './SpanOrBreak.vue'
/// UTILS
const shuffle = arr => {
@MarioSo
MarioSo / bend.vert
Last active February 1, 2019 18:38
VertexShader for bending things
varying vec2 vUv;
uniform float bendAngle;
uniform vec2 bounds;
uniform float bendOffset;
uniform float bendAxisAngle;
vec3 bend(vec3 ip, float ba, vec2 b, float o, float a) {
vec3 op = ip;
ip.x = op.x * cos(a) - op.y * sin(a);
ip.y = op.x * sin(a) + op.y * cos(a);
@MarioSo
MarioSo / resizeText.js
Created September 24, 2018 17:35
resizes text to match given horizontal boundaries
/**
* resizeText
* by Mario Sommer <mariosommer.at>
*
* based on Jeremy Apthorp's approach - thanks Jeremy
* improved performance by using binary seach algorithm to find font size
*/
export const resizeText = (el, opts = {}) => {
if (!opts.width && !opts.height) {
@MarioSo
MarioSo / array.includes.polyfill.js
Created February 19, 2017 17:48
Polyfill for Array.prototype.includes, currently not supported in IE & on Android
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
if (!Array.prototype.includes) {
Object.defineProperty(Array.prototype, 'includes', {
value: function(searchElement, fromIndex) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
@MarioSo
MarioSo / mso.sublime-theme
Created November 18, 2016 17:18
Sublime Text Theme
[
/* @EMPTY WINDOW
* Style for empty (no tabs) window
========================================================================= */
{
"class": "sheet_container_control",
"layer0.tint": [39, 40, 34],
"layer0.opacity": 1.0
@MarioSo
MarioSo / slt-key-bindings.txt
Created November 18, 2016 17:04
Sublime Text Key Bindings
[
{ "keys": ["ctrl+h"], "command": "unindent" },
{ "keys": ["ctrl+l"], "command": "indent" },
{ "keys": ["ctrl+k"], "command": "swap_line_up" },
{ "keys": ["ctrl+j"], "command": "swap_line_down" },
{ "keys": ["command+b"], "command": "extended_switcher", "args": {"list_mode": "window"} },
{ "keys": ["ctrl+command+b"], "command": "extended_switcher", "args": {"list_mode": "active_group"} },
{ "keys": ["ctrl+e"], "command": "goto_definition" },
{ "keys": [":", "v", "s", "p"], "command": "create_pane", "args": {"direction": "right", "give_focus": true} },
{ "keys": [":", "b", "d"], "command": "destroy_pane", "args": {"direction": "self"} }
@MarioSo
MarioSo / slt-user-settings.txt
Last active November 18, 2016 17:04
Sublime Text User Settings
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
@MarioSo
MarioSo / keyrepeat.shell
Created February 23, 2016 21:15 — forked from kconragan/keyrepeat.shell
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@MarioSo
MarioSo / toggle-remote-styles.js
Created October 23, 2015 08:09 — forked from gauntface/toggle-remote-styles.js
A book marklet to toggle styles.
javascript:(function(){var styles = document.querySelectorAll('link[rel=\'stylesheet\']'); for (var s = 0; s < styles.length; s++) {styles[s].mediax = styles[s].media;if (styles[s].media === 'only x') { styles[s].media = styles[s].mediax; } else if (styles[s].media !== 'print') {styles[s].media = 'only x';}}})();