This file contains hidden or 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 canvasWidth = 1200; | |
var canvasHeight = 1024; | |
function setup() { | |
createCanvas(canvasWidth, canvasHeight); | |
} | |
function draw() { | |
stroke("#DCA6A6"); | |
strokeWeight(0.1); |
This file contains hidden or 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 isPrime(value) { | |
// create cache | |
if (!isPrime.answers) { | |
isPrime.answers = {}; | |
} | |
// check was value cached | |
if (isPrime.answers[value] !== undefined) { | |
return isPrime.answers[value]; | |
} |
This file contains hidden or 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
let store = { | |
nextId: 1, | |
cache: {}, | |
add(fn) { | |
if(!fn.id) { | |
fn.id = this.nextId++; | |
this.cache[fn.id] = fn; | |
} | |
return false; | |
}, |
This file contains hidden or 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
html, | |
body { | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
width: 280px; | |
min-height: 250px; | |
padding-top: 50px; |
This file contains hidden or 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 *range(start, end, step=1) { | |
let i = start; | |
while ( i < end ) { | |
yield i; | |
i += step; | |
} | |
} | |
[...range(0,5)].map(x => x*2); |
This file contains hidden or 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 Fib = { | |
[Symbol.iterator]() { | |
var n1 = 1, n2 = 1; | |
return { | |
// make the iterator an iterable | |
[Symbol.iterator]() { return this; }, | |
next() { | |
var current = n2; |
This file contains hidden or 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 sys | |
import os | |
import re | |
from shellpython.helpers import Dir | |
''' | |
Compile *.md files to single or multiple pdf files | |
Requirments: | |
Python 3 |
This file contains hidden or 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
{"lastUpload":"2019-01-10T08:38:13.438Z","extensionVersion":"v3.2.4"} |
This file contains hidden or 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 numpy as np | |
import math | |
inp = np.matrix([[0.9], [0.1], [0.8]]) | |
wInp = np.matrix([[0.9, 0.3, 0.4],[0.2,0.8, 0.2],[0.1,0.5,0.6]]) | |
xHid = wInp.dot(inp) | |
sigmoid = np.vectorize(lambda x: 1 / (1 + math.exp(-x))) | |
outHid = sigmoid(xHid) |