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 is32Bit = function (c) { | |
return c.codePointAt(0) > 0xFFFF; | |
} | |
console.log(is32Bit('𠮷')); // true | |
console.log(is32Bit('a')); // 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
{ | |
"always_show_minimap_viewport": true, | |
"auto_close_tags": false, | |
"auto_complete": false, | |
"auto_indent": true, | |
"auto_match_enabled": false, | |
"bold_folder_labels": true, | |
"caret_style": "phase", | |
"close_windows_when_empty": true, | |
"color_scheme": "Packages/User/predawn (SL).tmTheme", |
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
<!-- This is the Block --> | |
<div class="carousel" data-widgettype="carousel"> | |
<!-- This is an Element. Notice that Elements class names use the name of the Block followed by a double underscore, then the name of the Element --> | |
<ul class="carousel__list" data-js="carousel-list"> | |
<li class="carousel__item"> | |
<span>List item</span> | |
</li> | |
<li class="carousel__item carousel__item--is-active"> <!-- This is an Element, which also contains a Modifier, Modifiers are named the same as the Element, but with a double dash followed by a modifier description --> | |
<span>List item</span> | |
</li> |
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
/* | |
Autoprefixer | |
https://github.com/nDmitry/grunt-autoprefixer | |
Adds vendor prefixes automatically | |
https://github.com/nDmitry/grunt-autoprefixer | |
*/ | |
autoprefixer: { | |
options: { | |
browsers: [ |
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 toggleClass(element, className) { | |
var newClass = ' ' + element.className.replace( /[\t\r\n]/g, ' ' ) + ' '; | |
if(hasClass(element, className)) { | |
while(newClass.indexOf(' ' + className + ' ') >= 0) { | |
newClass = newClass.replace(' ' + className + ' ' , ' '); | |
} | |
element.className = newClass.replace(/^\s+|\s+$/g, ''); | |
} else { | |
element.className += ' ' + className; | |
} |
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 removeClass(element, className) { | |
var newClass = ' ' + element.className.replace( /[\t\r\n]/g, ' ') + ' '; | |
if(hasClass(element, className)) { | |
while(newClass.indexOf(' ' + className + ' ') >= 0) { | |
newClass = newClass.replace(' ' + className + ' ', ' '); | |
} | |
element.className = newClass.replace(/^\s+|\s+$/g, ''); | |
} | |
} |
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 addClass(element, className) { | |
if(!hasClass(element, className)) { | |
element.className += ' ' + className; | |
} | |
} |
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 hasClass(element, className) { | |
return new RegExp(' ' + className + ' ').test(' ' + element.className + ' '); | |
} |
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
// Given a variable 'elements', which contains a Node List of HTML elements | |
for ( var i = 0; i < elements.length; i++ ) { | |
var self = elements[i]; | |
// Do stuff with element | |
self.doStuff(); | |
} |
NewerOlder