Английская версия: https://evilmartians.com/chronicles/bootstrap-an-intervention
У CSS есть несколько базовых проблем, которые позволяют очень быстро отстрелить себе ногу при неправильном использовании:
-
Глобальный неймспейс – в серверном программировании все что написано в файле, в файле и остается. Все же что написано в css и js засирает глобальное пространство имен со всеми вытекающими. В JS эту проблему сейчас побороли всякими модульными системами, а вот с css сложнее. В идеальном мире это должен починить Shadow DOM и настоящие Web Components, но пока их нет единственный способ с этим бороться – следовать какой-то системе именований селекторов, которая по возможности уменьшает и исключает возможные конфликты.
-
Каскадность – если на один элемент может сработать несколько правил, то они все и сработают последовательно. Если есть элемент
h1.title
, на него сработают все правила для теговh1
и все правила для класса.title
. Так как весь html состоит из тегов, то правил которые п
On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this
object, and we've seen some awesome benefits from doing such.
Up until recently, a typical unit test for us looked something like this:
describe('views.Card', function() {
// http://nikhilm.github.io/uvbook/threads.html | |
#include <string> | |
#include <map> | |
#include <node.h> | |
#include <v8.h> | |
#include <uv.h> | |
#include <sys/syscall.h> | |
#include <stdlib.h> |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
.tab-bar { | |
height: 34px; | |
padding: 0; | |
.tab { | |
-webkit-transform: none; | |
top: 2px; | |
line-height: 25px; | |
&.active { |
task convertFiles <<{ | |
fileTree("someFolder").matching{ include "**/*.txt"}.each{ aFile -> | |
exec{ | |
commandLine 'dos2unix' | |
args aFile.absolutePath | |
} | |
} | |
} |
/* | |
* This script will download a package (and all of its dependencies) from the | |
* online NPM registry, then create a gzip'd tarball containing that package | |
* and all of its dependencies. This archive can then be copied to a machine | |
* without internet access and installed using npm. | |
* | |
* The idea is pretty simple: | |
* - npm install [package] | |
* - rewrite [package]/package.json to copy dependencies to bundleDependencies | |
* - npm pack [package] |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.