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
function hiddenClone(element) { | |
var clone = element.cloneNode(true); | |
var style = clone.style; | |
style.position = 'relative'; | |
style.top = window.innerHeight + 'px'; | |
style.left = 0; | |
document.body.appendChild(clone); | |
return clone; | |
} |
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
var Person = function(name) { | |
this.name = name; | |
} | |
Person.prototype.greet = function(){ | |
console.log("Hi, " + this.name); | |
} | |
var Developer = function(name, skills) { | |
Person.apply(this.arguments); |
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
var isYoutube = videoUrl.match(/(?:youtu|youtube)(?:\.com|\.be)\/([\w\W]+)/i); | |
var isVimeo = videoUrl.match(/^.*(?:vimeo.com)\/(?:channels\/|channels\/\w+\/|groups\/[^\/]*\/videos\/|album\/\d+\/video\/|video\/|)(\d+)(?:$|\/|\?)/); |
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
var docViewTop = $(window).scrollTop(); | |
var docViewBottom = docViewTop + $(window).height(); | |
var elemTop = $(elem).offset().top; | |
var elemBottom = elemTop + $(elem).height(); | |
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); |
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
function digitNegativeNumbers(): any { | |
return { | |
restrict: 'A', | |
require: 'ngModel', | |
link(scope: IScope, element: HTMLElement, attrs: any, ngModelCtrl: any) { | |
function inputValue(val: string) { | |
if (val) { | |
const transformedValue = val.replace(/([^-\d.]+)?((-{0,1}\d*\.?\d*)(.*)?$)/, '$3'); | |
if (transformedValue !== val) { | |
ngModelCtrl.$setViewValue(transformedValue); |
OlderNewer