Skip to content

Instantly share code, notes, and snippets.

@jeanbauer
jeanbauer / form.js
Created December 16, 2018 01:15
Text Input using react hooks with a custom hook: useFormInput
import { useState } from 'react'
const Form = () => {
const name = useFormInput('Name')
return (
<>
<input {...name} />
</>
)

A complete list of books, articles, blog posts, videos and neat pages that support Data Fundamentals (H), organised by Unit.

Formatting

If the resource is available online (legally) I have included a link to it. Each entry has symbols following it.

  • ⨕⨕⨕ indicates difficulty/depth, from ⨕ (easy to pick up intro, no background required) through ⨕⨕⨕⨕⨕ (graduate level textbook, maths heavy, expect equations)
  • ⭐ indicates a particularly recommended resource; 🌟 is a very strongly recommended resource and you should look at it.
import React, { Component } from 'react';
export default class Item extends Component{
constructor(props){
super(props);
this.state = {
num: props.num,
isSaved: false
}
import React, { Component } from 'react';
import Item from './Item';
import './App.css';
class App extends Component {
constructor(){
super();
this.state = {
import numpy as np
import re
import itertools
from collections import Counter
def clean_str(string):
"""
Tokenization/string cleaning for all datasets except for SST.
Original taken from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
@learncodeacademy
learncodeacademy / gist:8acf7e3a2c4c33100f04c6715c662a01
Created June 11, 2018 14:23
Training a Neural Network - Enhanced Console Output From Brain.js
Start Training!...Here's the data, we'll do 2 iterations:
[ { input: [ 0, 1 ], output: [ 1, 0 ] },
{ input: [ 1, 1 ], output: [ 1, 1 ] } ]
======== TRAINING ITERATION 1 =========
--------- Run input set 0: 0,1 ----------
-> Layer 2 has 3 nodes
START NODE: 0
-> bias for node 0: 0.13861538469791412
-> weights for node 0:
-> input value: 0, weight: -0.03485306352376938
@gkjohnson
gkjohnson / gpu-info.js
Last active July 24, 2024 02:54
Extracting more detailed GPU information in a browser.
// Extracting more detailed GPU information in a browser.
// NOTE: This won't work with some privacy settings enabled
// and has only been tested with the following return values
// Could be used to guess at a GPUs power using existing benchmarks here:
// https://www.videocardbenchmark.net/GPU_mega_page.html
// https://www.techpowerup.com/gpu-specs/
// http://codeflow.org/entries/2016/feb/10/webgl_debug_renderer_info-extension-survey-results/
// http://www.gpuzoo.com/
// https://docs.google.com/spreadsheets/d/1wGRZ-5sl7G9DhIgwW36g2KnrwVfZqBW7GDKHOd2vbaM/edit#gid=0
// don't forget google maps import:
// <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC44mPpaMNvENXryYjHBHzjST1UMnYlARk"></script>
import React, { Component } from 'react'
import { withGoogleMap, GoogleMap, Marker } from 'react-google-maps'
class Map extends Component {
constructor(){
super()
class MyWindowPortal extends React.PureComponent {
constructor(props) {
super(props);
// STEP 1: create a container <div>
this.containerEl = document.createElement('div');
this.externalWindow = null;
}
render() {
// STEP 2: append props.children to the container <div> that isn't mounted anywhere yet