Skip to content

Instantly share code, notes, and snippets.

@kaktumar
kaktumar / gist:2ebbef4e6f8ddd33026f
Last active August 29, 2015 14:18
getFavicon(tab)
const tabToPromise = tab => {
let _then = favUrl => Promise.resolve(Object.defineProperty(tab,'favicon',{value:favUrl}));
return tab.favicon.then(_then,_then);
}
tabToPromise(tabData).then(bookmark =>
Request({
url: DBURL,
content: JSON.stringify(bookmark),
contentType: "application/json",
JSON.stringify(msg,null,'\t') // pretty print
@kaktumar
kaktumar / colors.py
Created July 21, 2017 23:47 — forked from sheljohn/colours-old.py
Print with colors in most shells (Python, standalone)
class ColorPrinter:
"""
Usage:
cprint = ColorPrinter()
cprint.cfg('c','m','bux').out('Hello','World!')
cprint.rst().out('Bye now...')
See: http://stackoverflow.com/a/21786287/472610
See: https://en.wikipedia.org/wiki/ANSI_escape_code
"""
http://strftime.org/
Code Meaning Example
%a Weekday as locale’s abbreviated name. Mon
%A Weekday as locale’s full name. Monday
%w Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. 1
%d Day of the month as a zero-padded decimal number. 30
%-d Day of the month as a decimal number. (Platform specific) 30
%b Month as locale’s abbreviated name. Sep
%B Month as locale’s full name. September