Angular doesn’t depend on jQuery. In fact, the Angular source contains an embedded lightweight alternative: jqLite. Still, when Angular detects the presence of a jQuery version in your page, it uses that full jQuery implementation in lieu of jqLite. One direct way in which this manifests itself is with Angular’s element abstraction. For example, in a directive you get access to the element that the directive applies to:
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() {| // Example | |
| // app.js | |
| document.addEventListener("DOMContentLoaded", function (e) { | |
| m.route.mode = "hash"; | |
| m.route(document.getElementById("application"), "/", { | |
| "/": m.resolve("pages.home"), | |
| "/findus": m.resolve("pages.findus") | |
| }); | |
| }); |
| server { listen 80; | |
| server_name example.com; | |
| access_log /var/log/example.com/nginx.access.log; | |
| error_log /var/log/example.com/nginx.error.log; | |
| root /var/www/apps/example.com/public; | |
| charset utf-8; | |
| location / { | |
| rewrite ^ https://$host$request_uri? permanent; | |
| } |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com, example2.com, and example1.com/images on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
| #!/usr/bin/env bash | |
| echo '' | |
| if [ "$1" = "" ]; then | |
| echo 'csp sha1 and sha256 generatoor' | |
| echo 'csp "code"' | |
| echo 'csp /file-name' | |
| else | |
| if [ -f "$1" ]; then | |
| CONTENT=$(cat $1) |
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
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |