I hereby claim:
- I am supermdguy on github.
- I am supermdguy (https://keybase.io/supermdguy) on keybase.
- I have a public key whose fingerprint is 8069 BAAD 1C45 FA27 0E40 43C1 006E 6DD7 CDBA 456B
To claim this, I am signing this object:
'''Using Gaussian Elimination Method to solve 3x3 systems of equations. | |
We'll use numpy arrays to store and manipulate the equations. For a video demonstrating the process, | |
I found https://youtu.be/Dj84vEb4Zko to be helpful. | |
''' | |
import numpy as np | |
A = np.zeros((3, 3)) #This will store the coefficients of the variables as a 3x3 numpy array | |
x = np.zeros((3, 1)) #This stores the values of the variables as a 3x1 numpy array | |
b = np.zeros((3, 1)) #This will store what the equations are equal to as a 3x1 numpy array |
// See https://github.com/vuejs/vue/blob/be9ac624c81bb698ed75628fe0cbeaba4a2fc991/src/core/observer/dep.js | |
// for full implementation | |
class Dep { | |
constructor() { | |
this.subs = new Set() | |
} | |
addSub(sub) { | |
this.subs.add(sub) |
// the current target watcher being evaluated. | |
// this is globally unique because there could be only one | |
// watcher being evaluated at any time. | |
Dep.target = null | |
const targetStack = [] | |
function pushTarget(_target) { | |
if (Dep.target) targetStack.push(Dep.target) | |
Dep.target = _target | |
} |
// See https://github.com/vuejs/vue/blob/be9ac624c81bb698ed75628fe0cbeaba4a2fc991/src/core/observer/watcher.js | |
// for full implementation | |
class Watcher { | |
constructor(getter, cb) { | |
this.getter = getter // function that returns a value based on reactive properties | |
this.cb = cb // function that is run on value updates, and is passed value and old value | |
this.value = this.get() | |
this.cb(this.value, null) | |
} |
// See https://github.com/vuejs/vue/blob/61187596b9af48f1cb7b1848ad3eccc02ac2509d/src/core/observer/index.js | |
// for full implementation | |
/* Walk through each property and convert them into | |
* getter/setters. This method should only be called when | |
* value type is Object. | |
*/ | |
function walk(obj) { | |
const keys = Object.keys(obj) | |
for (let i = 0; i < keys.length; i++) { |
const data = { | |
name: 'World', | |
feeling: 'like' | |
} | |
walk(data) // adds reactivity to the data object | |
new Watcher( | |
() => `Hello, ${data.name}. I ${data.feeling} Vue.js.`, // the value getter we're watching | |
(val, oldVal) => console.log(val) // the callback, fired on changes to dependencies of the value getter | |
) // logs 'Hello, World. I like Vue.js' |
<html> | |
<head> | |
<title> | |
Reactivity | |
</title> | |
<style> | |
div { | |
background: #989898; | |
color: #00FF11; | |
I hereby claim:
To claim this, I am signing this object:
<script> | |
const code = '(print (+ 1 (* 2 3) 3))' | |
const parsed = parse(code) | |
console.debug('Parsed AST', parsed) | |
evaluate(parsed[0]) | |
function parse(phrase) { | |
let seek = 0 | |
const parsed = [] |