Skip to content

Instantly share code, notes, and snippets.

View radi-cho's full-sized avatar

Radi Cho radi-cho

View GitHub Profile
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import { Button } from 'react-bootstrap';
import _ from 'lodash';
import * as teacherActions from '../../actions/teachers';
import * as classActions from '../../actions/classes';
import { isTeacherFetching, getTeacher } from '../../reducers/teachers';
{
"compileOnSave": true,
"compilerOptions": {
"watch": true,
"target": "es5",
"outFile": "demo.js",
"inlineSourceMap": true,
"removeComments": true
}
}
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 16,
// font family with optional fallbacks
// Before
import { RSGButton } from 'rsg-components'
import { RSGBox } from 'rsg-components';
import { RSGCheckbox, RSGLabel } from 'rsg-components'
import { RSGProgressBar as PB } from 'rsg-components'
// After 3.0.0-beta.1
import { Button } from 'rsg-components'
import { Box } from 'rsg-components';
import { Checkbox, Label } from 'rsg-components'
@radi-cho
radi-cho / keyboard-container.css
Created July 16, 2018 10:12
CSS Snipped for blogpost by Radi Cho - keyboard corpus
.keyboard {
position: absolute;
width: 600px;
height: 300px;
color: darkslategray;
border: 2px solid currentColor;
border-radius: 12px;
margin: 300px 10px 10px 65px;
transform: rotateX(30deg) rotateZ(0deg);
box-shadow: 2px 5px 12px currentColor;
@radi-cho
radi-cho / keyboard-button-container.css
Created July 16, 2018 10:20
CSS Snipped for blogpost by Radi Cho - keyboard buttons
.keyboard:before {
/* Don't forget the content */
content: "";
position: absolute;
width: 35px;
height: 30px;
border-radius: 3px;
border: 1px solid transparent;
color: lightgrey;
}
@radi-cho
radi-cho / keyboard-button-container-position.css
Created July 16, 2018 10:27
CSS Snipped for blogpost by Radi Cho - keyboard buttons and the disappearing shadows
/*
If we make it `display: none`, the shadows will disappear as well,
and the easiest solution will be something like this:
*/
left: -30px;
top: -30px;
@radi-cho
radi-cho / keyboard-button-positions.css
Created July 16, 2018 10:34
CSS Snipped for blogpost by Radi Cho - shadow positions
box-shadow: 45px 40px currentColor, 90px 40px currentColor,
135px 40px currentColor, 180px 40px currentColor, 225px 40px currentColor,
270px 40px currentColor, 315px 40px currentColor, 360px 40px currentColor,
405px 40px currentColor, 450px 40px currentColor, 495px 40px currentColor,
553px 40px currentColor, 573px 40px currentColor, 45px 80px currentColor,
90px 80px currentColor, 135px 80px currentColor, 180px 80px currentColor,
225px 80px currentColor, 270px 80px currentColor, 315px 80px currentColor,
360px 80px currentColor, 405px 80px currentColor, 450px 80px currentColor,
495px 80px currentColor, 540px 80px currentColor, 573px 80px currentColor,
45px 120px currentColor, 78px 120px currentColor, 123px 120px currentColor,
@radi-cho
radi-cho / fitData.js
Created September 23, 2018 18:54
Bag of Words model built with tfjs. How it works, how to train it and use for predictions.
// simple vocabulary with positive and negative terms
const vocabulary = ["bad", "slow", "ugly", "overrated", "expensive", "wrong", "good", "amazing", "fast", "kind", "cheap"];
const fitData = string => {
const stringSplit = string.replace(/[^a-zA-Z ]+/g, "").split(" ");
const words = {};
stringSplit.forEach(ev => {
words[ev] =
typeof words[ev] === "number" ? (words[ev] += 1) : (words[ev] = 1);
@radi-cho
radi-cho / linear-model-function.js
Created September 23, 2018 18:57
TF.js linear model inside Firebase Functions
exports.runLinearModel = functions.https.onRequest((request, response) => {
// Get x_test value from the request body
const x_test = Number(request.body.x);
// Check if the x value is number. Otherwise request a valid one and terminate the function.
if (typeof x_test !== "number" || isNaN(x_test))
response.send("Error! Please format your request body.");
// Define a model for linear regression.
const linearModel = tf.sequential();