Skip to content

Instantly share code, notes, and snippets.

View IpsumLorem16's full-sized avatar
:octocat:

IpsumLorem16

:octocat:
View GitHub Profile
@davidweatherall2
davidweatherall2 / z.scss
Created July 8, 2019 07:05
Z index sass helper function
// Z-index mapping: Correctly place your variable in the correct position based on what it should appear above and behind.
// Example usage: z-index: z(header);
$z-list: (
highest,
lowest
);
@function z($var) {
@IpsumLorem16
IpsumLorem16 / speech-synthesis-api-test.js
Last active March 15, 2020 13:24
Test of the speech synthesis api
//should speak in a british voice
// https://developers.google.com/web/updates/2014/01/Web-apps-that-talk-Introduction-to-the-Speech-Synthesis-API
var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[4]; // Note: some voices don't support altering params
msg.voiceURI = 'native';
msg.volume = 1; // 0 to 1
msg.rate = 1; // 0.1 to 10
msg.pitch = 1; //0 to 2
msg.text = ' This is a test';
@IpsumLorem16
IpsumLorem16 / GetClasses.js
Last active January 9, 2019 10:26
Gets all CSS classes in stylesheets and puts them into array Vanilla JS
let cssArray = [];
for (var i = 0; i < document.styleSheets.length; i++) {
var styleSheet = document.styleSheets[i];
for (var j = 0; j < 1; j++) {
let cssRules = styleSheet.cssRules;
for (var n = 0; n < cssRules.length; n++) {
cssArray.push(cssRules[n].selectorText);
}