This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Simple styles to have section elements skew at one end | |
*/ | |
.section { | |
clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prefix an integer with 0-s (zeros), resulting in the specified length | |
* | |
* @param num int integer to prepend | |
* @param length int length of the desired number | |
*/ | |
function prefixInteger(num, length) { | |
return (Array(length).join('0') + num).slice(-length); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple check so we could use a single button for different mobile OS-s | |
var operatingSystem, userAgentString = navigator.userAgent; | |
var link = $("#store"); | |
if (userAgentString.indexOf("iPhone") > -1 || userAgentString.indexOf("iPod") > -1 || userAgentString.indexOf("iPad") > -1) { | |
operatingSystem = "iOS"; | |
link.attr("href", "http://store.apple.com/us/browse/app"); | |
} else if (/Android/.test(userAgentString)) { | |
operatingSystem = "Android"; | |
link.attr("href", "https://play.google.com/store/apps?hl=en"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* author: andreas johan virkus | |
* snippet url: https://gist.github.com/andreasvirkus/bfaedc839de0d46ffe4c | |
* | |
* Remove classes that have given prefix | |
* Example: You have an element with classes "apple juiceSmall juiceBig banana" | |
* You run: | |
* $elem.removeClassPrefix('juice'); | |
* The resulting classes are "apple banana" | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// v1 | |
$.ajax({ | |
url: path, | |
xhrFields: { | |
onprogress: function (e) { | |
if (e.lengthComputable) { | |
// Progress.. | |
console.log(e.loaded / e.total * 100 + '%'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom jQuery select element | |
// Iterate over each select element | |
$('select').each(function() { | |
// Cache the number of options | |
var $this = $(this), | |
numberOfOptions = $(this).children('option').length; | |
// Hides the select element | |
$this.addClass('s-hidden'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).on('mousewheel DOMMouseScroll touchmove', function (e) { | |
var direction = (function () { | |
var delta, | |
compareEvent; | |
if (e.type ==='touchmove') { | |
compareEvent = 'touchmove'; | |
} else { | |
compareEvent = 'DOMMouseScroll'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function caesarShift(text, shift) { | |
var codes = []; | |
for (var i = 0; i < text.length; i++) { | |
var c = text.charCodeAt(i); | |
if (c >= 65 && c <= 90) { | |
c = (c - 65 + shift) % 26 + 65; // Uppercase | |
} else if (c >= 97 && c <= 122) { | |
c = (c - 97 + shift) % 26 + 97; // Lowercase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitch.tv - force old flash player | |
// @namespace ajvtwitchold | |
// @description Replaces default twitch player with old Flash player. | |
// @description original author - 420foxbot | |
// @description link to original script - https://gitlab.com/foxbot/Twitch5ForAll/raw/master/twitch5.user.js | |
// @version 1 | |
// @grant none | |
// @match http://*.twitch.tv/* | |
// ==/UserScript== |