Skip to content

Instantly share code, notes, and snippets.

David Waller krawaller

Block or report user

Report or block krawaller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
krawaller / LegoSetImage.js
Last active Oct 14, 2019
Redux useSelector and useDispatch hook test example
View LegoSetImage.js
import React, { FunctionComponent } from "react";
import { useSelector, useDispatch } from "react-redux";
import { selectCurrentSet, zoomImage } from "../dataLayer";
export const LegoSetImage: FunctionComponent = () => {
const set = useSelector(selectCurrentSet);
const dispatch = useDispatch()
const zoomHandler = () => dispatch(zoomImage(set.set_img_url))
return (
<div className="legoSetImageContainer">
View Guesses_index.js
import React from "react";
export const Guesses = props => {
return (
{, n) => (
<li key={n}>{guess}</li>
View todo.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
.done {
background-color: #DDD;
krawaller / object.js
Created Nov 1, 2017
object lookup examples
View object.js
var me = {
name: "David Waller",
nickName: "Davve",
prop: "kopp"
var formalSituation = true;
var prop;
krawaller / components.ts
Created Jul 25, 2017
Angular components as table rows
View components.ts
import { Component, Input } from '@angular/core';
selector: 'app',
template: `
<tr magicrow msg="hello"></tr>
<tr magicrow msg="world"></tr>

To create a container, I only need to add my AppState typings to the mapStateToProps parameter:

const mapStateToProps = (state: State) => ({
  messages: state.messaging.messages

const mapDispatchToProps = (dispatch) => ({
  dismissUIMessage: (num) => dispatch(actions.dismissUIMessage(num))
krawaller /
Created May 9, 2017
Enforcing Firebase relation validity

Say we have a database of users and roles, where each user belongs to a role. Using the denormalized Firebase approach I might store that like this:

  "users": {
    "abc123": {
      "name": "Joe",
      "role": "kkk333"
    // lots more users
krawaller / ng.html
Created May 10, 2016
fun fun angular stuff :)
View ng.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Exercise 1</title>
.done {
text-decoration: line-through;
krawaller / exercise1.html
Last active May 10, 2016
angular cheating
View exercise1.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Exercise 1</title>
<script src="../jquery.js"></script>
<script src="../angular.js"></script>
.selected {
text-decoration: line-through;
View myapp.js
var tags = ['urgent','blocked','boring','hard'],
callbacks = [];
return {
addTag: function(t){
You can’t perform that action at this time.