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
import {Directive, OnInit} from '@angular/core'; | |
import {ClrCombobox} from '@clr/angular'; | |
/** | |
* Utility directive to add a missing feature to Clarity comboboxes: Resetting the combobox search text after a | |
* selection. Clarity didn't add it for a11y reasons - for apps that don't need to worry about this in such a strct way | |
* this directive can help. Attach it to any Clariy Combobox and the searchtext will be set to empty string after the | |
* selection changes. | |
*/ | |
@Directive({ |
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
/** | |
* Directive that prevents clipping of Clarity dropdowns (maybe also popovers etc. - not tested) when they are inside | |
* containers that hide overflow. The trick is to just detach the element and attach it to the body. | |
* Use it like this on the element that is clipping: | |
* | |
* ``` | |
* <clr-dropdown-menu clrPosition="bottom-left" appAntiClipping> | |
* ``` | |
*/ | |
@Directive({ |
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
/** | |
* Pipe that let's you pipe just anything! Function calls in your templates are normally a bad idea, performance wise. | |
* However you can get around this problem by writing pipes that don't trigger on every CD cycle but only when the arguments change. | |
* Doing this for every function you want can be painful however! Here comes arbitraryPipedFunction for the rescue! | |
* Just pass the function, the arguments, the context and some extra arguments you may want to include in the watches arguments for the | |
* pipes internal CD. There you go. One pipe to rule them all. | |
*/ | |
@Pipe({ | |
name: 'arbitraryPipedFunction' | |
}) |
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
// created for use in textAngulars ta-paste="modifyHtml($html)" option | |
// http://textangular.com/ | |
$scope.modifyHtml = function($html){ | |
var DOMTree = jQuery(jQuery.parseHTML($html, null, false)); | |
jQuery.each(DOMTree, function(key, value){ | |
jQuery(value).removeAttr('style').find('*').removeAttr('style').removeClass(); | |
}); | |
return jQuery('<div>').append(DOMTree).html(); | |
}; |
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
import tokenize | |
from token import * | |
def print_metrics(path): | |
"""prints LOC and NCLOC of the input file""" | |
fo = open(path, "rb") # open file in byte mode | |
tokens = tokenize.tokenize(fo.readline) # tokenize it |