Skip to content

Instantly share code, notes, and snippets.

View bgord's full-sized avatar

Bartosz Gordon bgord

View GitHub Profile
import React from "react";
import { render } from "react-dom";
class App extends React.PureComponent {
state = {
showSecret: false
};
toggleShowSecret = () =>
this.setState({ showSecret: !this.state.showSecret });
render() {
return (
import React from "react";
import { render } from "react-dom";
const IF = ({ children, condition, fallback }) =>
condition ? children : fallback;
class App extends React.PureComponent {
state = {
showSecret: false
};
toggleShowSecret = () =>
this.setState({ showSecret: !this.state.showSecret });
import React from "react";
import PropTypes from "prop-types";
class ConditionalDisplay extends React.PureComponent {
static defaultProps = {
fallback: null
};
static propTypes = {
children: PropTypes.oneOfType([PropTypes.element, PropTypes.string])
.isRequired,
const { bgWhite } = require("chalk");
module.exports = class ProgressBar {
constructor() {
this.total;
this.current;
this.bar_length = process.stdout.columns - 30;
}
init(total) {
const ProgressBar = require("./ProgressBar");
const { get } = require("https");
const URL = "https://stackoverflow.com/";
const Bar = new ProgressBar();
const request = get(URL, response => {
const total = response.headers["content-length"];
let current = 0;