Skip to content

Grzegorz Judas#9

Open
grzegorzjudas wants to merge 1 commit into
masterfrom
grzegorz-judas
Open

Grzegorz Judas#9
grzegorzjudas wants to merge 1 commit into
masterfrom
grzegorz-judas

Conversation

@grzegorzjudas
Copy link
Copy Markdown

No description provided.

@kapke
Copy link
Copy Markdown

kapke commented Sep 21, 2016

Do we really want to merge commit named "Grzegorz Judas"?

Copy link
Copy Markdown

@kapke kapke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch called grzegorz-judas? Does that branch contain Grzegorz Judas?

Every sample has its own directory and that is very to see how specific code is working. So divide it into directories and provide example of using specific directive. Without example it doesn't make sense for anyone. As these examples are in AngularJS, you can rename directory angular-edrna into just angular.

@@ -0,0 +1,174 @@
'use strict';

var refreshData;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why global variable? It's antipattern and should not be published as sample of good code.


var refreshData;

angular.module('edrnaApp').directive('reorderWrapper', ['$timeout', '$compile', '$document',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why edrnaApp here? Maybe just app?

$scope.reorderComplete = typeof $scope.reorderComplete === 'function' ? $scope.reorderComplete : new Function();

$scope.$on('draggable:start', function(scope, e) {
var _handler = angular.element(e.event.target);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why some variables are prefixed with _ and some not?

}
});

$scope.$on('draggable:end', function(e, d) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that e is an event. I have no idea what is d

$scope.reorderComplete(angular.copy($scope.reorderData), originalElementPosition, overallDiff);
});

var getElements = function(callback) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not function getElements () {}? That's much better than var getElements = function () {}.

  1. Hoisting
  2. Easier to read due to different code highlight
  3. Easier to debug due to function name in stack traces

var getElements = function(callback) {
if(typeof callback !== 'function') callback = new Function();

$timeout(function() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear why that timeout is used here

}

function SubConverterCfg(SubConverterProvider) {
SubConverterProvider.addSrcConverter('application/x-subrip', function(data) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add every converter in separate file. That would be much more readable.

return result;
});
}
})();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any usage example. I think that would be great to see how people can use it.

}
});

lines = lines.filter(function(l) { return true; });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's purpose of that line?

var parsed = [];
var lines = data.split('</text>');
var tagRegex = /^<text start="([0-9]+(.|)([0-9]+|))" dur="([0-9]+(.|)([0-9]+|))">/;
// lines = lines.filter(function(line) { return line.match(tagRegex) !== null; });
Copy link
Copy Markdown

@kapke kapke Sep 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

return supportedDst.indexOf(mime) !== -1;
}

function converter() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That function is a constructor function and it's name should start from upper cased C as for rest of constructors there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants