- What rules do the community tend to override? - airbnb/javascript#1089
- Best Practices for component state in ReactJs - http://brewhouse.io/blog/2015/03/24/best-practices-for-component-state-in-reactjs.html
This file contains hidden or 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 getPosition(el) { | |
let xPos = 0; | |
let yPos = 0; | |
while (el) { | |
if (el.tagName == 'BODY') { | |
// deal with browser quirks with body/window/document and page scroll | |
const xScroll = el.scrollLeft || document.documentElement.scrollLeft; | |
const yScroll = el.scrollTop || document.documentElement.scrollTop; |
This file contains hidden or 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
export function setVendor(element, property, value) { | |
element.style["Webkit" + property] = value; | |
element.style["Moz" + property] = value; | |
element.style["ms" + property] = value; | |
element.style["o" + property] = value; | |
element.style[property] = value; | |
} |
This file contains hidden or 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
export function getSiblings(elem) { | |
var siblings = []; | |
var sibling = elem.parentNode.firstChild; | |
for ( ; sibling; sibling = sibling.nextSibling ) { | |
if ( sibling.nodeType === 1 && sibling !== elem ) { | |
siblings.push( sibling ); | |
} | |
} | |
return siblings; | |
} |
This file contains hidden or 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
{ | |
"parser": "babel-eslint", | |
"env": { | |
"node": true, | |
"browser": true, | |
"es6": true | |
}, | |
"extends": "airbnb-base", | |
"parserOptions": { | |
"sourceType": "module", |
This file contains hidden or 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
mixin svg(id, viewbox, className) | |
if viewbox | |
svg(viewbox='#{viewbox}', class!=className) | |
use(xlink:href='assets/img/sprite.svg#' + id) | |
else | |
svg(viewbox='0 0 50 50', class!=className) | |
use(xlink:href='assets/img/sprite.svg#' + id) | |
//- Usage: +svg('symbolID', 'viewbox parameters', 'classnames') |
This file contains hidden or 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
<?php | |
/* = Limit Excerpt | |
/* Usage: echo get_excerpt(250) | |
-------------------------------------------------------------- */ | |
function get_excerpt($limit, $source = null){ | |
if($source == "content" ? ($excerpt = get_the_content()) : ($excerpt = get_the_excerpt())); | |
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt); | |
$excerpt = strip_shortcodes($excerpt); | |
$excerpt = strip_tags($excerpt); |
This file contains hidden or 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
<?php | |
// ========================================================================= | |
// REMOVE JUNK FROM HEAD | |
// ========================================================================= | |
remove_action('wp_head', 'rsd_link'); // remove really simple discovery link | |
remove_action('wp_head', 'wp_generator'); // remove wordpress version | |
remove_action('wp_head', 'feed_links', 2); // remove rss feed links (make sure you add them in yourself if youre using feedblitz or an rss service) | |
remove_action('wp_head', 'feed_links_extra', 3); // removes all extra rss feed links |
This file contains hidden or 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
<?php | |
function modify_admin_bar_position() { | |
if ( is_user_logged_in() ) { ?> | |
<style type="text/css"> | |
body { | |
margin-top: -32px; | |
padding-bottom: 32px; | |
} |
This file contains hidden or 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 getTranslate(item: HTMLElement): number | number[] | undefined { | |
const transArr = []; | |
if (!window.getComputedStyle) { | |
return; | |
} | |
const style = window.getComputedStyle(item); | |
const transform = style.transform || style.webkitTransform; | |
let mat = transform.match(/^matrix3d\((.+)\)$/); | |
if (mat) { | |
return parseFloat(mat[1].split(', ')[13]); |