This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSectionHeader(element, headerDepth = 6){ | |
const headerSelector = Array(headerDepth).fill().map((i,idx) => `h${idx+1}`).join(','); | |
console.log(headerSelector); | |
if (element.matches(headerSelector)) { | |
return element; | |
} | |
const tempAttr = 'data-getSectionInTitleElement'; | |
element.setAttribute(tempAttr, ""); | |
const els = document.querySelectorAll(`${headerSelector},[${tempAttr}]`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In a large CMS site (or sites), where content authors can add any component to any page at any time, it's sometimes tricky to figure out how to integrate Vue apps and components in a way that plays well together, especially when we don't want to need to bundle all our javascript on pageload and load stuff that's not necessary on one page or another. | |
Whatever the backend, DomInitor will take care of initializing Vue (and/or JS coomponents) based on data attributes, but only load the javascript it needs for a given page AND work in IE11. | |
It works by scanning the HTML of your page for data attributes and using the values of them + webpack to asynchronously load all the js chunks. | |
There is a lot of code specific to my use case here, but it gives a good example of how to achieve the dream of being able to have Vue components built as SFCs and bundled by webpack easily used within a massive 'legacy'/'oldschool' website while only loading the components used on any given page. (Caveat: because this is run onc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var path = require('path'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
var sassLoaders = [ | |
'css', | |
'autoprefixer-loader?browsers=last 2 version', | |
'sass-loader?includePaths[]=' + __dirname + '/app/styles&sourceMap=true' | |
]; | |
//set entry-points and plugins that are the same across dev and prod. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"term": "black cat", "description":"a black feline"}, | |
{"term": "cat", "description": "meow"} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["super+alt+up"]: "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} }, | |
["super+alt+s"]: "save_all" }, | |
["super+ctrl+f"]: "toggle_full_screen" }, | |
["super+ctrl+shift+f"]: "toggle_distraction_free" }, | |
["super+option+v"]: "paste_from_history" }, | |
["ctrl+alt+left"]: "move", "args": {"by": "subwords", "forward": false} }, | |
["ctrl+alt+right"]: "move", "args": {"by": "subword_ends", "forward": true} }, | |
["ctrl+alt+shift+left"]: "move", "args": {"by": "subwords", "forward": false, "extend": true} }, | |
["ctrl+alt+shift+right"]: "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, | |
["ctrl+left"]: "move", "args": {"by": "subwords", "forward": false} }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"detect_slow_plugins": false, | |
"font_size": 8, | |
"highlight_modified_tabs": true, | |
"ignored_packages": | |
[ | |
"Vintage", | |
"TrailingSpaces" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img width="1" height="1" title="" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABBJREFUeNpi+P//PwNAgAEACPwC/tuiTRYAAAAASUVORK5CYII=" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Auto-focus linked inputs. Only works for in-page links so far*/ | |
$('a[href^="#"]').on('click', function(e){ | |
target = $(this).attr('href'); | |
$(target).filter(':input').focus(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){function c(a,b){var c=document.createElement("textarea");c.name=a;c.value=b;d.appendChild(c)}var e=function(a){for(var b="",a=a.firstChild;a;){switch(a.nodeType){case Node.ELEMENT_NODE:b+=a.outerHTML;break;case Node.TEXT_NODE:b+=a.nodeValue;break;case Node.CDATA_SECTION_NODE:b+="<![CDATA["+a.nodeValue+"]]\>";break;case Node.COMMENT_NODE:b+="<\!--"+a.nodeValue+"--\>";break;case Node.DOCUMENT_TYPE_NODE:b+="<!DOCTYPE "+a.name+(a.publicId?' PUBLIC "'+a.publicId+'"':"")+(!a.publicId&&a.systemId? " SYSTEM":"")+(a.systemId?' "'+a.systemId+'"':"")+">\n"}a=a.nextSibling}return b}(document),d=document.createElement("form");d.method="POST";d.action="http://validator.w3.org/check";d.enctype="multipart/form-data";d.target="_blank";c("fragment",e);c("doctype","HTML5");c("group","0");document.body.appendChild(d);d.submit()})(); |
NewerOlder