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
const describe = (desc, fn) => { | |
console.log(desc) | |
fn() | |
} | |
const it = (msg, fn) => describe(' ' + msg, fn) | |
const matchers = (exp) => ({ | |
toBe: (asssertion) => { | |
if (exp === assertion) { |
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
const { | |
describe, | |
it, | |
expect, | |
matchers | |
} = require('./index') | |
let executes = 0 | |
const noop = () => { executes += 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
describe('expect', () => { | |
it('returns an object', () => { | |
const actual = expect(true) | |
expect(typeof actual).toBe('object') | |
expect(typeof actual.toBe).toBe('function') | |
}) | |
}) |
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
describe('matchers', () => { | |
describe('toBe', () => { | |
it('works', () => { | |
const actual = matchers('1').toBe('1') | |
expect(actual).toBe(true) | |
}) | |
}) | |
}) |
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
const { | |
describe, | |
it, | |
expect, | |
matchers | |
} = require('./index') | |
let executes = 0 | |
const noop = () => { executes += 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
import matplotlib.pyplot as plt | |
import numpy as np | |
# original data set | |
X = [1, 2, 3] | |
y = [1, 2.5, 3.5] | |
# slope of best_fit_1 is 0.5 | |
# slope of best_fit_2 is 1.0 | |
# slope of best_fit_3 is 1.5 |
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 | |
X = np.array([[1], [2], [3]]) | |
y = np.array([[1], [2.5], [3.5]]) | |
get_theta = lambda theta: np.array([[0, theta]]) | |
thetas = list(map(get_theta, [0.5, 1.0, 1.5])) | |
X = np.hstack([np.ones([3, 1]), X]) |
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
// store.js | |
const state = { | |
first: "", | |
last: "" | |
} | |
export const getters = { | |
message: (state) => { | |
return state.first + ' ' + state.last | |
} |
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
<template> | |
<div> | |
<div>{{ msg }}</div> | |
<div>{{ post.title }}</div> | |
</div> | |
</template> | |
// ... |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script src="https://cdn.rawgit.com/vuejs/vue/dev/dist/vue.min.js"></script> | |
<script src="https://cdn.rawgit.com/vuejs/vue/dev/packages/vue-template-compiler/browser.js"></script> | |
<script src="https://cdn.rawgit.com/vuejs/vue-test-utils/dev/packages/test-utils/dist/vue-test-utils.iife.js"></script> | |
<script src="https://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js"></script> | |
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" /> |