Skip to content

Instantly share code, notes, and snippets.

@lethalbrains
lethalbrains / plot_roc.py
Created April 15, 2018 14:57 — forked from code-of-kpp/plot_roc.py
Python pyplot receiver operating characteristic (ROC) curve with colorbar
import numbers
import six
import numpy
import matplotlib.collections
from matplotlib import pyplot
# using example from
# http://nbviewer.ipython.org/github/dpsanders/matplotlib-examples/blob/master/colorline.ipynb
// Current syntax
function fetchJson(url) {
return fetch(url)
.then(request => request.text())
.then(text => {
return JSON.parse(text);
})
.catch(error => {
console.log(`ERROR: ${error.stack}`);
});
// All the code snippets below are acceptable
let obj = {
first: 'Naruto',
last: 'Uzumaki',
}
let array = [
'red',
'green',
const obj = {
id: 123,
get bar() { return 'abc' },
};
console.log(Object.getOwnPropertyDescriptors(obj));
> { id:
{ value: 123,
writable: true,
enumerable: true,
> 'a'.padEnd(5, 'xy')
'axyxy'
> 'a'.padEnd(4, 'xy')
'axyx'
> '1234'.padEnd(2, '#')
'1234'
> '###'.padEnd(10, '0123456789')
'###0123456'
> 'a'.padEnd(10)
'a '
> 'a'.padStart(5, 'xy')
'xyxya'
> 'a'.padStart(4, 'xy')
'xyxa'
> '1234'.padStart(2, '#')
'1234'
> '###'.padStart(10, '0123456789')
'0123456###'
> 'a'.padStart(10)
' a'
let data = { "King" : "Jon Snow",
"Queen" : "Daenerys Targaryen",
"Hand" : "Tyrion Lannister"}
console.log(Object.values(data))
> ["Jon Snow","Daenerys Targaryen","Tyrion Lannister"]
let data = { "King" : "Jon Snow",
"Queen" : "Daenerys Targaryen",
"Hand" : "Tyrion Lannister"}
console.log(Object.entries(data))
> [["King","Jon Snow"],["Queen","Daenerys Targaryen"],["Hand","Tyrion Lannister"]]
let squared = 2 ** 2 // value of squared is 4
, cubed = 2 ** 3 // value of cubed is 8
let squared = 2,
, cubed = 3
squared **= 2 // same as: squared = squared * squared
cubed **= 3 // same as: cubed = cubed * cubed * cubed