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
/* | |
Returns an alphabethic or value-base ascending/descending sorted Object (child objects sorted if recursive) | |
*/ | |
Object.prototype.sort = function(recursive, direction, caseSensitive, sortByValue) { | |
var dir = (direction ? direction : "ASC"); | |
var me = this; | |
var tempArray = []; | |
/* | |
Sorting function for value-based (sortByValue) sorting | |
*/ |
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
/* | |
Warning: This way is for sure not performant | |
*/ | |
document.getElementsByStyleProperty = function(property, value){ | |
var allBodyElements = document.body.querySelectorAll("*"); | |
var selectedElements = []; | |
var allBodyElementsLength = allBodyElements.length; | |
for (var i = 0; i < allBodyElementsLength; ++i) { | |
if (Extend.getStyleProperty(allBodyElements[i], property) == value) { | |
selectedElements.push(allBodyElements[i]); |
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
/* | |
Validates if a value actually is a number | |
*/ | |
function isNumeric(value) { | |
return !isNaN(parseFloat(value)) && isFinite(value); | |
} |
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
//creates a new <style></style>-tag | |
var style = document.createElement('style'); | |
/*** GENERATE CSS HERE ***/ | |
//adds the whole css rules to your styles tag | |
style.appendChild(document.createTextNode(CSS)); | |
//applied it to your head which now start effecting your DOM | |
document.head.appendChild(style) |
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
let Diff = { | |
CHANGED : 'change', | |
REMOVED : 'remove', | |
ADDED : 'add' | |
} | |
function diffMap(base, diff) { | |
let changes = new Map(); | |
for (let [property, value] of base) { |
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 mapToObject(map){ | |
let obj = {} | |
for (let [prop, value] of map){ | |
if (value instanceof Map){ | |
obj[prop] = mapToObject(value); | |
} else { | |
obj[prop] = value; | |
} | |
} | |
return obj; |
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 objectToMap(obj){ | |
let map = new Map(); | |
let i; | |
let keys = Object.keys(obj); | |
let length = keys.length; | |
for (i = 0; i < length; ++i){ | |
let temp = obj[keys[i]]; | |
if (temp instanceof Object){ | |
map.set(keys[i], objectToMap(temp)); |
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
<div style={[ | |
styles.box, | |
this.props.checked && styles.checked, | |
this.props.editable && this.state.editMode && styles.editable, | |
... | |
]}> | |
</div> |
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(){Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(ele){ele.style.background = 'rgba(0, 129, 255, 0.05)'})})(); |
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
/* | |
* Your Stylesheet | |
* | |
* This stylesheet is loaded when Atom starts up and is reloaded automatically | |
* when it is changed. | |
* | |
* If you are unfamiliar with LESS, you can read more about it here: | |
* http://www.lesscss.org | |
*/ |
OlderNewer