Skip to content

Instantly share code, notes, and snippets.

View pickleat's full-sized avatar

Andy Pickle pickleat

View GitHub Profile
{
// Paste these into a `.code-snippets` file in VS Code.
"php echo open and close": {
"scope": "php, html",
"prefix": "phpe",
"body": [
"<?= $0; ?>"
]
},
"php open and close brackets": {
@pickleat
pickleat / madeWithLove.html
Last active March 18, 2021 13:02
emojiAriaLabel
<!-- BAD -->
<div>
<a href="https://twitter.com/pickleat">Made with &#10084; by Andy Pickle</a>
</div>
<!-- Good! -->
<a href="https://twitter.com/pickleat">
Made with <span role="img" aria-label="love">&#10084;</span> by Andy Pickle
</a>
@pickleat
pickleat / QuillJSExample-3.js
Created May 22, 2020 00:57
A more elegant solution to formatting
useEffect( () => {
// formats the Markdown
function styleChildren(children) {
children.forEach((child) => {
let tagIt = child.tagName
child.classList = blogStyle[tagIt]
if(tagIt === 'CODE' && child.innerText.length > 15){child.classList = longCode[tagIt]}
if(tagIt === 'CODE' && child.innerText.length <= 15){child.classList = shortCode[tagIt]}
if(child.children) {
let grandChildren = [...child.children]
@pickleat
pickleat / QuillJSExample-2.js
Created May 22, 2020 00:52
Inelegant Formatting Solution
useEffect(() => {
// Cleans up the text provided by QuillJS wysiwyg
function styleChildren(children) {
children.forEach((child) => {
if (child.tagName === 'H1') {
child.classList = quillStyle.h1
}
if (child.tagName === 'H2') {
child.classList = quillStyle.h2
}
@pickleat
pickleat / QuillJSExample-1.html
Last active May 22, 2020 01:01
QuillJS Example-1
<div>
<h1>An Example Heading!</h1>
<p><br></p>
<p>Here's a bunch of paragraph text that shows you
<strong>how awesome it is</strong>
to write here!</p>
<p><br></p>
<p>Here's a list: </p>
<ul>
<li>Item</li>