This file contains 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
const fs = require('fs'); | |
const mappings = require('./mappings'); | |
function doId(path, token) { | |
if (!mappings[token]) { | |
console.log(`Cannot find ${token} mappings file.`); | |
process.exit(1); | |
} | |
const contents = mappings[token] + '\n' + | |
fs.readFileSync(path, 'utf-8'); |
This file contains 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
describe('User controller', () => { | |
let userService, userCtrl; | |
beforeEach(inject((_userService_, $controller) => { | |
userService = _userService_; | |
userCtrl = $controller(UserCtrl, { | |
user: { | |
name: 'Barbara' | |
} |
This file contains 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
public class InjectTestAction extends AnAction { | |
@Override | |
public void actionPerformed(AnActionEvent e) { | |
PsiFile file = e.getData(PlatformDataKeys.PSI_FILE); | |
Caret caret = e.getData(PlatformDataKeys.CARET); | |
Editor editor = e.getData(PlatformDataKeys.EDITOR); | |
JSParameterList injectParameterList = findInjectParameterList(file); | |
This file contains 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
public class InjectTestAction extends AnAction { | |
@Override | |
public void actionPerformed(AnActionEvent e) { | |
Project project = getEventProject(e); | |
Editor editor = e.getData(PlatformDataKeys.EDITOR); | |
PsiFile file = e.getData(PlatformDataKeys.PSI_FILE); | |
Caret caret = e.getData(PlatformDataKeys.CARET); | |
JSParameterList injectParameterList = findInjectParameterList(file); |
This file contains 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
@Nullable | |
private JSParameterList findInjectParameterList(PsiFile file) { | |
// Recursively find all the call expressions in the file. | |
Collection<JSCallExpression> callExpressions = | |
PsiTreeUtil.findChildrenOfType(file, JSCallExpression.class); | |
for (JSCallExpression jsCallExpression : callExpressions) { | |
// Find the inject() element. | |
if (jsCallExpression.getText().startsWith("inject")) { | |
// Get the parameter list. Should be a child of the call expression. | |
return PsiTreeUtil.findChildOfType(jsCallExpression, JSParameterList.class); |
This file contains 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
exports.config = { | |
seleniumAddress: 'http://localhost:4444/wd/hub', | |
specs: ['todo-spec.js'] | |
}; |
This file contains 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
describe('angularjs homepage todo list', function() { | |
it('should add a todo', function() { | |
browser.get('http://www.angularjs.org'); | |
element(by.model('todoText')).sendKeys('write a protractor test'); | |
element(by.css('[value="add"]')).click(); | |
var todoList = element.all(by.repeater('todo in todos')); | |
expect(todoList.count()).toEqual(3); | |
expect(todoList.get(2).getText()).toEqual('write a protractor test'); |
This file contains 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 | |
# | |
# Require: | |
# sudo apt-get install librsvg2-bin | |
# sudo apt-get install pngcrush | |
# | |
# Usage: | |
# sh svg2png.sh input.svg output.png | |
rsvg-convert -o "$2" "$1" |