Alone in a locked metal cage, 10 feet from my nearest colleague, a robot approaches from the shadows and thrusts a tower of shelves towards me. I have nine seconds to grab and process an item to be sent for packing – a target of 300 items an hour, for hour after relentless hour. As I bend to the floor then reach high above my head to fulfil a never-ending stream of orders, my body screams at me. Welcome to Amazon’s picking floor. Here, while cameras watch my every move, a screen in front of me offers constant reminders of my “units per hour” and exactly how long each has taken. This is the online giant’s biggest European packing plant, set to be shipping 1.2 million items a year. As the UK’s top retailer, it made £7.3billion last year alone. But a Sunday Mirro
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:
This file contains 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> | |
<head> | |
<title> | |
Reactivity | |
</title> | |
<style> | |
div { | |
background: #989898; | |
color: #00FF11; | |
This file contains 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
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' |
This file contains 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
// 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++) { |
This file contains 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
// 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) | |
} |
This file contains 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
// 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 | |
} |
This file contains 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
// 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) |
This file contains 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
'''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 |
NewerOlder