This is no longer needed as Emmet supports JSX - you just need to turn it all on. Did a quick tutorial: http://wesbos.com/emmet-react-jsx-sublime/
Thanks, @wesbos
- Using emmet in jsx files
- Emmet expands text when js autocomplete needed
| // ---------------------------------------------------------- | |
| // A short snippet for detecting versions of IE in JavaScript | |
| // without resorting to user-agent sniffing | |
| // ---------------------------------------------------------- | |
| // If you're not in IE (or IE version is less than 5) then: | |
| // ie === undefined | |
| // If you're in IE (>=5) then you can determine which version: | |
| // ie === 7; // IE7 | |
| // Thus, to detect IE: | |
| // if (ie) {} |
This is no longer needed as Emmet supports JSX - you just need to turn it all on. Did a quick tutorial: http://wesbos.com/emmet-react-jsx-sublime/
Thanks, @wesbos
| #!/bin/bash | |
| #!/bin/bash | |
| # | |
| # ssh into a machine and automatically set the background | |
| # color of Mac OS X Terminal depending on the hostname. | |
| # | |
| # Installation: | |
| # 1. Save this script to /usr/local/bin/ssh-host-color | |
| # 2. chmod 755 /usr/local/bin/ssh-host-color | |
| # 3. alias ssh=/usr/local/bin/ssh-host-color |
| #!/bin/sh | |
| # | |
| # Mac OSX Adblocker Script for IPv4 | |
| # Description: Blocks ads using system hosts file /private/etc/hosts, Ad-Domains would be redirected to 0.0.0.0 | |
| # Author: Daniel Hochleitner | |
| # Created: 10.09.2015 | |
| # Use: sudo ./adblock_hosts.sh | |
| # Get original hosts file from /private/etc/hosts |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParentАнглийская версия: https://evilmartians.com/chronicles/bootstrap-an-intervention
У CSS есть несколько базовых проблем, которые позволяют очень быстро отстрелить себе ногу при неправильном использовании:
Глобальный неймспейс – в серверном программировании все что написано в файле, в файле и остается. Все же что написано в css и js засирает глобальное пространство имен со всеми вытекающими. В JS эту проблему сейчас побороли всякими модульными системами, а вот с css сложнее. В идеальном мире это должен починить Shadow DOM и настоящие Web Components, но пока их нет единственный способ с этим бороться – следовать какой-то системе именований селекторов, которая по возможности уменьшает и исключает возможные конфликты.
Каскадность – если на один элемент может сработать несколько правил, то они все и сработают последовательно. Если есть элемент h1.title, на него сработают все правила для тегов h1 и все правила для класса .title. Так как весь html состоит из тегов, то правил которые п
| /** | |
| * MIT No Attribution | |
| * | |
| * Copyright 2015 Giovanni Thenstead | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
| ffmpeg -i input.mov -vcodec libwebp -lossless 1 -q:60 -preset default -loop 0 -an -vsync 0 output.webp |
| import { Component } from 'preact'; | |
| export default class PureComponent extends Component { | |
| shouldComponentUpdate(props, state) { | |
| return !(shallowEqual(props, this.props) && shallowEqual(state, this.state)); | |
| } | |
| } | |
| function shallowEqual(a, b) { | |
| for (let key in a) if (a[key]!==b[key]) return false; |
| /** | |
| * Prevent body scroll and overscroll. | |
| * Tested on mac, iOS chrome / Safari, Android Chrome. | |
| * | |
| * Based on: https://benfrain.com/preventing-body-scroll-for-modals-in-ios/ | |
| * https://stackoverflow.com/a/41601290 | |
| * | |
| * Use in combination with: | |
| * html, body {overflow: hidden;} | |
| * |