Skip to content

Instantly share code, notes, and snippets.

View englishextra's full-sized avatar
💜
the beat goes on

englishextra englishextra

💜
the beat goes on
View GitHub Profile
@ewpratten
ewpratten / hosts-yt-ads
Last active November 30, 2023 18:45
youtube ads hosts file
This project has been moved to a GitHub repository to allow Pull Requests.
See: https://github.com/Ewpratten/youtube_ad_blocklist
@Aymkdn
Aymkdn / loadExt.js
Last active December 31, 2022 04:32
To load JS and CSS files with vanilla JavaScript
// long version
function loadExt(files, after) {
var _this=this;
_this.files = files;
_this.js = [];
_this.head = document.getElementsByTagName("head")[0];
_this.after = after || function(){};
_this.loadStyle = function(file) {
var link = document.createElement("link");
link.rel = "stylesheet";
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active April 17, 2024 18:56
Vanilla JavaScript Quick Reference / Cheatsheet
@englishextra
englishextra / ie8Events.js
Created March 20, 2016 09:24 — forked from chriswrightdesign/ie8Events.js
Polyfill for IE8 Javascript Event Listeners
(function() {
if (!Event.prototype.preventDefault) {
Event.prototype.preventDefault=function() {
this.returnValue=false;
};
}
if (!Event.prototype.stopPropagation) {
Event.prototype.stopPropagation=function() {
this.cancelBubble=true;
};
@micahjon
micahjon / loadScript.js
Last active November 5, 2017 12:59
Promise-based Asynchronous Script Loader
/**
* Loads javascript file by url and saves reference to it by name, so it's not loaded again
* @param {string} name Name of js library
* @param {string} url Url to js library
* @return {promise} Resolves when library is loaded
*
* Based on example by Brad Berger: https://bradb.net/blog/promise-based-js-script-loader/
* Extended w/ global variable to keep track of previously loaded scripts.
* Removed support for loading several independent scripts at once via Promise.all()
*
@certainlyakey
certainlyakey / library.scss
Last active March 5, 2024 16:40
URL-encode color SASS function / convert color to hex SASS function
//does not work with colors containing alpha
@function encodecolor($string) {
@if type-of($string) == 'color' {
$hex: str-slice(ie-hex-str($string), 4);
$string:unquote("#{$hex}");
}
$string: '%23' + $string;
@return $string;
}
@SleepWalker
SleepWalker / swipe.js
Created September 30, 2015 04:59
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.screenX;
touchstartY = event.screenY;
@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@davidhund
davidhund / feature-detect flexbox.js
Last active October 17, 2019 16:02
The simplest feature-detect for flexbox?
/*
* Trying to feature-detect (very naive)
* CSS Flexbox support.
* - Only most modern syntax
*
* Is this nonsense?
*/
(function NaiveFlexBoxSupport(d){
var f = "flex", e = d.createElement('b');
@jacrook
jacrook / font_variables.scss
Last active July 2, 2023 16:47
Sass Css Font Stack Variables
//////////////////////////////////////////////////////////////
// Font Variables (http://cssfontstack.com/)
//////////////////////////////////////////////////////////////
//
// Serif font-stacks
//
$baskerville-font-stack: "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif !default;