Built with Splitting
A Pen by ricardo galvez on CodePen.
| // If the image is broken / not available then you can sneak this in... | |
| <img src='some.jpg' onerror='this.remove()' /> |
| // | |
| // This produces a solid 3d | |
| // @param $color {value} - hex or rgba | |
| // @param $num {number} - number of shadows to apply | |
| // @param $spread {number} - the shadow's spread | |
| // @param $blur {number} - the text shadow's blur | |
| // @param $y {number} - the y value | |
| // @param $x {number} - the x value | |
| // |
| const phoneBook = {}; | |
| const names = ['Mira', 'Royce', 'Kathie']; | |
| const numbers = ['3234958675', '9164059384', '4154958675'] | |
| // we need to retrun this: | |
| // const phoneBook = { | |
| // 'Mira': '3234958675', | |
| // 'Royce': '9164059384', | |
| // 'Kathie': '4154958675', | |
| // } |
| function rangeOfNumbers(startNum, endNum) { | |
| if (startNum - endNum === 0) { | |
| return [startNum] | |
| } else { | |
| // declare the variable range and give it the value of our recursive function rangeOfNumbers | |
| //console.log(startNum) | |
| let range = rangeOfNumbers(startNum, endNum - 1); | |
| console.log(endNum, endNum - 1) | |
| range.push(endNum); |
| const shuffleArray = function (array = []) { | |
| if (!Array.isArray(array) && array.length > 0) return; | |
| const a = [...array]; | |
| for (let i = a.length - 1; i > 0; i--) { | |
| const j = Math.floor(Math.random() * (i + 1)); | |
| [a[i], a[j]] = [a[j], a[i]]; | |
| } | |
| return a; | |
| }; |
| // | |
| // Random numbers | |
| // for whatever reason, even though I use this all the time, | |
| // I can never remember it...🕺 | |
| function getRandomInt(max) { | |
| return Math.floor(Math.random() * Math.floor(max)); | |
| } | |
| function getRandom(max, min) { |
| <!-- | |
| Easy text transform for cleaning up generated names and using as variables in a Hugo partial template | |
| Since I use this for creating aria attributes, this strips out spaces and replaces w/ dash and transforms the string to lower | |
| Then wrap in parens and pass that to the built in lower function to transform. easy. | |
| --> | |
| {{ $title := .Title }} | |
| {{ $ariatitle := lower (replaceRE "(\\s)" "-" $title) }} | |
| <h3 id="{{ $ariatitle }}"> | |
| <a href="{{ .Permalink }}" aria-labelledby="{{ $ariatitle }}">{{ .Title }}</a> |
Built with Splitting
A Pen by ricardo galvez on CodePen.
An exploration in creating a more graphic headline treatment using overlaps, transparency, and color
A Pen by ricardo galvez on CodePen.
| const shuffleArray = function(array) { | |
| const a = [...array]; | |
| for (let i = a.length - 1; i > 0; i--) { | |
| const j = Math.floor(Math.random() * (i + 1)); | |
| [a[i], a[j]] = [a[j], a[i]]; | |
| } | |
| return a; | |
| }; |