Lecture 1: Introduction to Research β [πLecture Notebooks] [
Lecture 2: Introduction to Python β [πLecture Notebooks] [
Lecture 3: Introduction to NumPy β [πLecture Notebooks] [
Lecture 4: Introduction to pandas β [πLecture Notebooks] [
Lecture 5: Plotting Data β [πLecture Notebooks] [[
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
// tools/jest/setupTests.js | |
const error = console.error; | |
console.error = (...args) => | |
// Suppress error messages regarding network error in tests | |
/Error: Request failed with status code 500/m.test( | |
args[0] | |
) | |
? void 0 | |
: error(...args); |
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
// Referenced from https://gist.github.com/mandiwise/dc53cb9da00856d7cdbb | |
// List line count of all tracked files | |
$ git ls-files | xargs wc -l | |
// Match only certain file-types | |
$ git ls-files -- '*.js*' | xargs wc -l | |
// Add additional file-types to count | |
$ git ls-files -- '*.js*' '*.jsx' '*.tsx' '*.css' | xargs wc -l |
(I'm enjoying doing these raw, barely edited writeups; I hope they're useful to you too)
This is my own writeup on feature flags; for a deep dive I'd recommend something like Martin Fowler's article (https://martinfowler.com/articles/feature-toggles.html).
So. Feature flags. The basic idea that you'll store configuration/values on a database/service somewhere, and by changing those values, you can change the user experience/features for a user on the fly.
Let's say that you're building a new feature, called 'new-button' which changes the color of buttons, which is currently red, to blue. Then you'd change code that looks like this -
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 UserContext = React.createContext(); | |
class App extends React.Component { | |
state = { | |
user: null, | |
setUser: user => { | |
this.setState({ user }); | |
} | |
}; |
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 * as React from "react"; | |
type Value = boolean; | |
type ContextWithSetter = React.Context<{ | |
value: Value; | |
setValue: (value: Value) => void; | |
}>; | |
const { Provider, Consumer }: ContextWithSetter = React.createContext({ |
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 React, { Component, createContext } from 'react' | |
function initStore(store) { | |
const Context = createContext(); | |
class Provider extends React.Component { | |
constructor() { | |
super(); | |
this.state = store.initialState; | |
} |
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
version: '3.3' | |
services: | |
keycloak: | |
image: jboss/keycloak-mysql | |
environment: | |
- constraint:serverclass==gateway | |
- PROXY_ADDRESS_FORWARDING=true | |
- MYSQL_USER=keycloak |
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
db: | |
image: postgres | |
environment: | |
- POSTGRES_DB=keycloak | |
- POSTGRES_USER=keycloak | |
- POSTGRES_PASSWORD=password | |
- POSTGRES_ROOT_PASSWORD=root_password | |
keycloak: |
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
// π₯ Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('β'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |
NewerOlder