Skip to content

Instantly share code, notes, and snippets.

View john-theo's full-sized avatar
🏠
Working from home

John Dope john-theo

🏠
Working from home
View GitHub Profile
@fnky
fnky / ANSI.md
Last active March 17, 2026 21:10
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@guilhermejcgois
guilhermejcgois / getStyle.ts
Last active June 23, 2025 06:17
Get computed styles (in typescript)
// Gist adapted from: https://gist.github.com/cms/369133
export getStyle(el: Element, styleProp: string): string {
let value;
const defaultView = el.ownerDocument.defaultView;
// W3C standard way:
if (defaultView && defaultView.getComputedStyle) {
// sanitize property name to css notation (hypen separated words eg. font-Size)
styleProp = styleProp.replace(/([A-Z])/g, '-$1').toLowerCase();
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
} else if (el['currentStyle']) { // IE