<commit_before>#https://github.com/angular-ui/ui-codemirror/blob/master/ui-codemirror.js
#https://github.com/angular-ui/bootstrap/blob/master/src/buttons/buttons.js
#https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js
#http://jsfiddle.net/dalcib/6kabF/2/
#http://jsfiddle.net/simpulton/GeAAB/  -- sharemsg
###
http://jsfiddle.net/vojtajina/YdAsa/
Binding directive from another directive

You can apply directive from directive, but not sure why would you do that. Something like this should work:

angular.directive('first', function(expression, element) {
  var compiler = this;
  // compile....
  return function(instance) {
    var scope = this;
    // link...
  };
});

angular.directive('second', function(expression, element) {
  // apply compile fn of first directive
  var firstLinker = angular.directive('first').call(this, 'some-expression', element);

  return function(instance) {
    // apply linker of the first directive
    firstLinker.call(this, instance);
  };
});
###
angular.module('iReactive', [])
    .constant('clickableConfig', {
        # lowest, highest, step, lowestIn, highestIn
        # null means no limited
        range: [-Infinity, Infinity, 1, true, true]
    })
    .directive('iClickable', ['clickableConfig', '$timeout', (clickableConfig, $timeout) ->
        'use strict'

        restrict: 'A'
        #require: 'ngModel'
        link: ($scope, element, attrs) ->
            options = clickableConfig || {}
            opts    = angular.extend({}, options, $scope.$eval(attrs.iClickable))
            range   = opts.range
            Array::push.apply(range, clickableConfig.range[range.length..]) if range.length < clickableConfig.range.length

            applyRange = (value, range) ->
                if angular.isNumber value
                    minV = range[0]
                    maxV = range[1]
                    step = range[2]
                    lowestIn  = range[3]
                    highestIn = range[4]
                    value += step
                    if step > 0       # step > 0?
                        if (value < minV) or (value >= maxV)
                            value = minV if value != maxV or !highestIn
                            value += step if !lowestIn
                    else if step < 0
                        if (value <= minV) or (value > maxV)
                            value = maxV if value !=minV or !lowestIn
                            value += step if !highestIn
                    value

            if angular.isDefined(opts.bind) #and angular.isDefined(opts.range)
                #opts = angular.extend(opts, parseRange(opts.range))

                element.addClass('i-clickable editable')
                #element.bind('click', clickingCallback)
                element.bind('click', (el)->
                    value = $scope[opts.bind]
                    value = applyRange(value, range)

                    # In clickingCallback, if you are changing any model/scope data,
                    # you'll want to call scope.$apply(), or put the contents of the
                    # method inside scope.$apply(function() { ...contents here...});
                    #$scope.$apply(opts.bind+"="+value)
                    $scope[opts.bind] = value
                    $scope.$apply()
                    return
                )
            return
    ])
<commit_msg>* comments for ref<commit_after>#https://github.com/angular-ui/ui-codemirror/blob/master/ui-codemirror.js
#https://github.com/angular-ui/bootstrap/blob/master/src/buttons/buttons.js
#https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js
#http://jsfiddle.net/dalcib/6kabF/2/   -- 
#http://jsfiddle.net/simpulton/GeAAB/  -- sharemsg
#http://jsfiddle.net/simpulton/EMA5X/  -- animateoin
###
http://jsfiddle.net/vojtajina/YdAsa/
Binding directive from another directive

You can apply directive from directive, but not sure why would you do that. Something like this should work:

angular.directive('first', function(expression, element) {
  var compiler = this;
  // compile....
  return function(instance) {
    var scope = this;
    // link...
  };
});

angular.directive('second', function(expression, element) {
  // apply compile fn of first directive
  var firstLinker = angular.directive('first').call(this, 'some-expression', element);

  return function(instance) {
    // apply linker of the first directive
    firstLinker.call(this, instance);
  };
});
###
angular.module('iReactive', [])
    .constant('clickableConfig', {
        # lowest, highest, step, lowestIn, highestIn
        # null means no limited
        range: [-Infinity, Infinity, 1, true, true]
    })
    .directive('iClickable', ['clickableConfig', '$timeout', (clickableConfig, $timeout) ->
        'use strict'

        restrict: 'A'
        #require: 'ngModel'
        link: ($scope, element, attrs) ->
            options = clickableConfig || {}
            opts    = angular.extend({}, options, $scope.$eval(attrs.iClickable))
            range   = opts.range
            Array::push.apply(range, clickableConfig.range[range.length..]) if range.length < clickableConfig.range.length

            applyRange = (value, range) ->
                if angular.isNumber value
                    minV = range[0]
                    maxV = range[1]
                    step = range[2]
                    lowestIn  = range[3]
                    highestIn = range[4]
                    value += step
                    if step > 0       # step > 0?
                        if (value < minV) or (value >= maxV)
                            value = minV if value != maxV or !highestIn
                            value += step if !lowestIn
                    else if step < 0
                        if (value <= minV) or (value > maxV)
                            value = maxV if value !=minV or !lowestIn
                            value += step if !highestIn
                    value

            if angular.isDefined(opts.bind) #and angular.isDefined(opts.range)
                #opts = angular.extend(opts, parseRange(opts.range))

                element.addClass('i-clickable editable')
                #element.bind('click', clickingCallback)
                element.bind('click', (el)->
                    value = $scope[opts.bind]
                    value = applyRange(value, range)

                    # In clickingCallback, if you are changing any model/scope data,
                    # you'll want to call scope.$apply(), or put the contents of the
                    # method inside scope.$apply(function() { ...contents here...});
                    #$scope.$apply(opts.bind+"="+value)
                    $scope[opts.bind] = value
                    $scope.$apply()
                    return
                )
            return
    ])

{'fraction_non_alphanumeric': 0.12302977232924693, 'fraction_numerical': 0.003356684179801518, 'mean_word_length': 1.7455929487179487, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1452579', 'n_tokens_mistral': 1922, 'n_tokens_neox': 1819, 'n_words': 453}