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 os, sys | |
def cprintf(str, clr): | |
""" Basic colored printing """ | |
red = "\x1b[31m" | |
green = "\x1b[32m" | |
yellow = "\x1b[33m" | |
reset = "\x1b[0m" |
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
private calculateRelativeCoords(event: MouseEvent): IRelativeCoords { | |
const target: JQuery = $(this.target); | |
const offset = target.offset(); | |
const parentOffset = target.offsetParent(); | |
let relativeX = ((event.pageX - 15) - offset.left); | |
let relativeY = ((event.pageY - 15) - offset.top); | |
relativeX = (relativeX / target.width()) * 100; | |
relativeY = (relativeY / target.height()) * 100; |
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
private _debounce(func, wait, immediate) { | |
let timeout; | |
return () => { | |
const context = this; | |
const later = () => { | |
timeout = null; | |
if (!immediate) func.apply(context); | |
}; | |
const callNow = immediate && !timeout; |