- U: Working file was updated
- G: Changes on the repo were automatically merged into the working copy
- M: Working copy is modified
- C: This file conflicts with the version in the repo
- ?: This file is not under version control
- !: This file is under version control but is missing or incomplete
- A: This file will be added to version control (after commit)
- A+: This file will be moved (after commit)
This docker image is a Selenium Webdriver server where our specs will be directed against. It contains the Firefox and Chrome to run our specs headless. It also provides us VNC access to check what is going on the browser.
$ docker run --rm --net="host" -e VNC_PASSWORD=pancakes elgalu/selenium:v2.45.0-ssh3
- Use one-time-bind on expressions ( {{::value}} )
- Replace
$scope.$apply()with$scope.$digest()whenever possible - Move filters to controllers
To get the total watchers on the current page, you can run this script on the browser console:
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
| #!/bin/sh | |
| # | |
| # An example hook script to log commit messages | |
| # as a 'daily highlight' in RescueTime Premium | |
| # | |
| # See README.md for more information | |
| # | |
| # To enable this hook: | |
| # | |
| # 1. Place this file in .git/hooks and rename to "post-commit". |
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
| javascript: (function ($) { | |
| var storyTitles = []; | |
| var story = $('.story .details').closest('.story').first(); | |
| if(story){ | |
| var title = story.find('.editor.name').val(); | |
| var id = /story_(\d+)/.exec(story.attr('class'))[1]; | |
| var storyType = story.find(".story_type .selection").text(); | |
| var gitptTitle = id + '-' + title; | |
| var translate = { | |
| "ä": "ae", "ö": "oe", "ü": "ue", "ß": "ss" |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This is an example of how to test an Angular Resource created with $resource.
Important take aways:
- Do not mock $resource. Instead, you can use the resource's methods and assert that it is making the right API call. By doing that you can later change the implementation (for example for replace
$resourcefor Angular Cached Resource) without needing toi go change all previous tests. - When intercepting the response of a custom method, do not transform the response string into json yourself. When you use the
transformResponseaction property of a$resource, you replace the default angular parser that is transforming backend response from string to JSON. It has some logic to ensure that the response is a JSON and can be parsed securely. You can use it by injecting$httpinto your factory and using `$http.defaults.transformRespon
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
| # Testing an Angular $resource factory | |
| #angular #medium | |
| Learn from live example how to test a $resource factory. What to test? What /not/ to test? When to use $resource? These questions will be answered here. | |
| [DEMO LINK](https://gist.run/?id=38949509eed11e6c1527218385579f80) | |
| Let's start with a brief review. | |
| ## What is $resource and when to use it? |