Skip to content

Instantly share code, notes, and snippets.

View vojtajina's full-sized avatar

Vojta Jina vojtajina

View GitHub Profile
if (action.isArray) {
if (!angular.isArray(data)) {
throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected response to contain an array but got an object');
}
value.length = 0;
forEach(data, function(item) {
value.push(new Resource(item));
});
} else {
// DSL - these migt be provided by protractor
// `protractor` is globally provided instance of Provider (connected webdriver instance)
// `protractor.driver` can be the wrapper webdriver instance
var navigateTo = protractor.get;
var element = protractor.getElementByCssSelector;
var button = function(label) {
return protractor.getElementByCssSelector(':button:contains("' + label + '")');
};
// We should provide some syntactic sugar for defining custom helpers.
@vojtajina
vojtajina / webstorm-karma.log
Created July 22, 2013 00:35
/usr/local/nvm/v0.10.2/bin/node "/Applications/WebStorm 7 EAP.app/plugins/js-karma/js_reporter/karma-intellij/lib/intellijRunner.js" --karmaPackageDir=/Users/vojta/Code/angular.dart/node_modules/karma --runnerPort=9101
##teamcity[enteredTheMatrix]
##teamcity[testSuiteStarted nodeId='1' parentNodeId='0' name='karma.conf.js' nodeType='config' locationHint='config:///Users/vojta/Code/angular.dart/karma.conf.js']
##teamcity[testSuiteStarted nodeId='2' parentNodeId='1' name='Chrome 29.0.1530 (Mac OS X 10.8.4)' nodeType='browser']
##teamcity[testCount count='307']
##teamcity[testStarted nodeId='3' parentNodeId='2' name='MockHttp should replay an http request' nodeType='test' locationHint='test://MockHttp should replay an http request']
##teamcity[testFinished nodeId='3' duration='5']
##teamcity[testStarted nodeId='4' parentNodeId='2' name='MockHttp should replay an http request which is expected multiple times' nodeType='test' locationHint='test://MockHttp should replay an http request which is expected multiple times']
##teamcity[testFinished nodeId='4' duration='1']
##teamcity[testStarted nodeId='5' parentNodeId='2' name='MockHttp should throw an exeception on assertAllGetsCalled when not all expected GETs were called' nodeType
@vojtajina
vojtajina / mySpec.js
Created July 7, 2013 23:39
Protractor proposal... I can run it with: $ protractor my.conf.js
// This is my TEST...
describe('angularjs homepage', function() {
beforeEach(function() {
navigateTo('http://angularjs.org/');
});
it('should greet', function() {
// any css selector
element('input[ng-model=yourName]').sendKeys('Julie');
@vojtajina
vojtajina / load_data.scala
Last active December 18, 2015 20:17
zeppelin-issue
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
val testresults = sqlContext.read.json("/Users/vojta/Code/test.json")
testresults.registerTempTable("testresults")
testresults.printSchema()
// Output:
// sqlContext: org.apache.spark.sql.SQLContext = org.apache.spark.sql.SQLContext@5c927efe
// testresults: org.apache.spark.sql.DataFrame = [build: string, date: string, finished_epoch: double, first_failed_test_category: string, first_failed_test_error_string: string, first_failed_test_id: string, model: string, result_finished: string, result_started: string, root_test_category: string, root_test_id: string, status: string, tags: struct<mail_failure:boolean,product_failure:boolean,spotlight_failure:boolean,suggestd_failure:boolean>, train: string, uuid: string]
// root
// |-- build: string (nullable = true)
@vojtajina
vojtajina / fetch-git-pr.bash
Created May 8, 2013 04:19
Bash script for fetching a pull request from github...
# fetching a single pull request from github
# put it into ~/.profile or ~/.bashrc
function fetch_pr() {
PR=$1
BRANCH=$2
if [ -z $PR ]; then
echo "Missing pull request number"
return 1
fi
@vojtajina
vojtajina / bench.js
Created October 19, 2012 05:18
async.forEach vs. sync forEach (very lame)
var async = require('async');
var fs = require('fs');
var files = [];
while(files.length < 100000) {
files.push('/some/file' + files.length);
}
@vojtajina
vojtajina / Preferences.sublime-settings.json
Created September 14, 2012 05:55
Sublime Text - preferences
{
"auto_complete_commit_on_tab": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/User/Monokai Vojta.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 12.0,
"highlight_line": true,
"hot_exit": false,
"ignored_packages":
[
@vojtajina
vojtajina / sublime.sh
Created September 14, 2012 04:34
Shell script to start Sublime Text
#!/bin/sh
# Shell script to start Sublime
# @author Vojta Jina <vojta.jina@gmail.com>
if [ -z $@ ]; then
# no arguments, try to find project
# TODO(vojta): traverse up to find projects in parent directories
PROJECT=`ls *.sublime-project 2>/dev/null`
@vojtajina
vojtajina / grunt.js
Created August 14, 2012 08:17
Grunt script for inlining AngularJS templates
module.exports = function(grunt) {
grunt.initConfig({
inline: {
'index.html': ['tpl/*.html']
}
});
grunt.registerMultiTask('inline', 'Inline AngularJS templates into single file.', function() {
var SCRIPT = '<script type="text/ng-template" id="<%= id %>"><%= content %></script>\n';