Skip to content

Instantly share code, notes, and snippets.

💭
ArangoDB is kinda cool

Paceaux paceaux

💭
ArangoDB is kinda cool
Block or report user

Report or block paceaux

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@paceaux
paceaux / tinyRules.css.md
Last active Jan 13, 2020
Tiny rules for how to name things in CSS and JS
View tinyRules.css.md

Tiny rules for how to name stuff

CSS

How to name CSS classes

Stateful Class names

Is it a state that is only one of two conditions? (i.e. a boolean)

View iterators.arrays.js
/** Creates an array that, when iterated, only returns ruthy items
* @param {array} iterable
*
* @example const mixedBag = new TruthyArray(1, 0, 'foo', '', true, false, undefined, null, 'three'])
* for (item of mixedBag) {
* console.log(item);
* }
*
*/
@paceaux
paceaux / implicit-explicit.arrays.js
Last active Dec 9, 2019
Samples of loops over an array that seem to show an implicit and explicit undefined for arrays
View implicit-explicit.arrays.js
function ifIn(array) {
console.group(`ifIn======`);
let i = 0;
while (i < array.length) {
if (i++ in array) {
console.log(`${i - 1} is in the array`);
}
}
console.groupEnd();
View conjunctions.english.js
/*
* Conjunctions
* https://www.english-grammar-revolution.com/list-of-conjunctions.html
*/
module.exports = [
{
conjunction: ['and'],
type: 'coordinating',
},
@paceaux
paceaux / SearchMap.js
Last active Oct 28, 2019
SearchMap: A JavaScript Map with searchable keys
View SearchMap.js
/** Evaluates an array, makes the key lowercasee and makes the value an object with original keyname
* @param {Array} iterable=[] an array of arrays:[[key,val],[key,val]]
* @returns Array
*/
function LowercaseIterable(iterable = []) {
if (iterable.length === 0) return [];
const newIterable = iterable.map(([key, val]) => {
const entry = [
key.toLowerCase(),
@paceaux
paceaux / heart.css
Created May 10, 2012
Beating heart with CSS3
View heart.css
.heart {
width: 20em;
height: 20em;
position: relative;
overflow: hidden;
}
.heart span {
display: block;
position: absolute;
width: 10em;
@paceaux
paceaux / speaker.js
Created Sep 3, 2019
Interface for speech synthesis in the browser
View speaker.js
/**
* @typedef SpeakerDefaults
* @type {object}
* @property {string} voiceURI voice that the browser uses
* @property {Number} volume loudness. Between 0 and 1.0
* @property {Number} rate speed at which words are spoken. Between 0 and 2.
* @property {Number} pitch Between 0 and 2
* @property {string} lang ISO language
*/
View this.js
var these = _itshelf = itshelf = _shelf = shelf = _itself = itself =_self = self = _me = me = _that = that = _this = this;
@paceaux
paceaux / queryCSSProperty
Last active Jun 30, 2019
Get all CSS selectors containing a particular CSS property
View queryCSSProperty
/** queryCSSByPropertyName
* queries the CSSOM looking for CSS rulesets containing a particular CSS property.
* @param {string} queryPropName CSS property name
* @param {string} queryPropValue value of CSS property
* @returns Map with key as CSS selector, value as CSS properties.
*/
function queryCSSByProperty(queryPropName, queryPropValue) {
const styleSheets= document.styleSheets; // get all the stylesheets
const properties = new Map(); // set up the variable that'll store our result
View convertColorName.js
function convertColorName (name) {
var testEl = document.createElement('div'),
rgb;
testEl.style.backgroundColor = name;
rgb = document.body.appendChild(testEl);
rgb = window.getComputedStyle(testEl).backgroundColor;
document.body.removeChild(testEl);
return rgb;
You can’t perform that action at this time.