https://facebook.github.io/react/docs/tutorial.html
##If you finish up and want to try something else:
| id = "viewport-size-by-edmundojr-paulodiovani" | |
| # Cria o elemento do viewport, se ainda não existir | |
| create = -> | |
| div = document.getElementById(id) || document.createElement "div" | |
| div.id = id | |
| div.style.cssText = """ | |
| position:fixed; \ | |
| top:0; \ | |
| right:0; \ |
| // ---- | |
| // Sass (v3.3.14) | |
| // Compass (v1.0.1) | |
| // ---- | |
| $icon-names: ( | |
| user : '\e972', | |
| camera : '\e603', | |
| heart : '\e601', | |
| bubble : '\e96d', |
| const closest = (elem, className) => { | |
| if (elem==null || elem.classList==null) return null | |
| return (elem.classList.contains(className) ? elem : closest(elem.parentNode, className)) | |
| } |
https://facebook.github.io/react/docs/tutorial.html
##If you finish up and want to try something else:
| <?php | |
| /** | |
| * Add Photographer Name and URL fields to media uploader | |
| * | |
| * @param $form_fields array, fields to include in attachment form | |
| * @param $post object, attachment record in database | |
| * @return $form_fields, modified form fields | |
| */ | |
| const toClassString = (obj) => Object.keys(obj).filter((key) => obj[key]===true).join(' ').trim() |
| const hasTouchscreen = () => { | |
| const mobileDevice = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) | |
| const onTouchEnd = ('ontouchend' in document.documentElement) | |
| return (mobileDevice && onTouchEnd) | |
| } |
| const toggler = (initState) => { | |
| initState = initState!==false | |
| let state = initState | |
| return { | |
| get : () => state, | |
| reset : () => state = initState, | |
| toggle : () => state = !state, |
| const select = (query, elem = null) => { | |
| elem = (elem==null ? document : elem) | |
| let elems = elem.querySelectorAll(query) | |
| if (elems==null) return [] | |
| else return Array.prototype.slice.call(elems, 0) | |
| } |
| const counter = (min, max, initial) => { | |
| let index = initial - min | |
| let length = max - min + 1 | |
| return (modifier = 0) => { | |
| index = (index + modifier) % length | |
| if (index>=0) index = 0 + index |