Skip to content

Instantly share code, notes, and snippets.

View sebjwallace's full-sized avatar

Sebastian Wallace sebjwallace

  • United Kingdom
View GitHub Profile
function Hello(name){
return ["div", null,
["b", null, "Hello "],
["i", null, name]
];
}
function prerender(root){
for(var i in root)
if(Array.isArray(root[i]))
function styles(padding){
return {
padding: padding + 'px',
backgroundColor: '#ddd'
}
}
function Hello(name, styles){
return ["div", {style:styles}, "Hello " + name]
}
function extend(base, derivative){
for(var i in base)
if(!derivative[i])
derivative[i] = base[i]
return derivative
}
var base = {
color: '#555',
fontSize: '2em'
.Media {
display: flex;
align-items: stretch;
}
.Media__image {
margin-right: 1em;
}
.Media__body {
@sebjwallace
sebjwallace / AND_perceptron.js
Created May 13, 2016 16:44
One of the most simplest 'perception' training the 'AND' operator
var inputs = [
[0,0],
[1,0],
[0,1],
[1,1]
]
var outputs = [
0, 0, 0, 1
@sebjwallace
sebjwallace / OR_AND_perceptron.js
Created May 13, 2016 17:44
Another simple 'perceptron' implementing a bias to work with both AND / OR
var inputs = [
[0,0],
[1,0],
[0,1],
[1,1]
]
var outputs = [
// AND
@sebjwallace
sebjwallace / temporal-network.js
Last active May 28, 2018 18:28
Temporal Pooling inspired by cortical layers 4 & 2/3
class layer4 {
constructor(){
this.distal = [
// X,A,B,C,D,Y
[0,0,0,0,0,0], // X
[0,0,0,0,0,0], // A
[1,1,0,0,0,0], // B
[0,0,1,0,0,0], // C
@sebjwallace
sebjwallace / machine.js
Last active November 5, 2019 21:03
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'switch',
initial: 'off',
states: {
off: {
on: {
FLIP: 'on'
}
},
on: {
@sebjwallace
sebjwallace / machine.js
Created November 5, 2019 21:07
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'transistor',
initial: 'off',
states: {
off: {
on: {
HIGH: 'on',
LOW: 'off'
}
},
@sebjwallace
sebjwallace / machine.js
Last active November 5, 2019 21:11
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'NOT',
initial: 'off',
states: {
off: {
on: {
HIGH: 'off',
LOW: 'on'
}
},