Skip to content

Instantly share code, notes, and snippets.

View mpj's full-sized avatar

Mattias Petter Johansson mpj

View GitHub Profile
@mpj
mpj / code2.jsx
Last active March 24, 2020 16:57
code2.jsx
import React, { useEffect, useState } from 'react';
import logo from './logo.svg';
import './App.css';
import { Map, TileLayer, Marker, Popup, Tooltip } from 'react-leaflet'
import tmi from 'tmi.js'
// https://nominatim.openstreetmap.org/search?format=json&q=stockholm,sweden
// Firebase App (the core Firebase SDK) is always required and must be listed first
import * as firebase from "firebase/app"
@mpj
mpj / code.jsx
Created March 23, 2020 16:49
Code for episode
import React, { useEffect, useState } from 'react';
import logo from './logo.svg';
import './App.css';
import { Map, TileLayer, Marker, Popup, Tooltip } from 'react-leaflet'
import tmi from 'tmi.js'
// !<command> <args> ? !register Sweden ?
// !checkin SE I am streaming
@mpj
mpj / remoteworking.md
Last active March 23, 2020 14:34
Resources and ideas for remote workers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Intro to XState</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div id="box"></div>
@mpj
mpj / noc.html
Created February 10, 2020 17:13
<script
src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.min.js"></script>
<script>
class Particle {
constructor() {
this.position = createVector(20, 20)
this.radius = 15
this.velocity = createVector(1, 1)
this.acceleration = createVector(0.0, 0.0)
@mpj
mpj / vanilla-hofs-with-reduce.js
Created February 3, 2020 14:16
code from episode
const isMoreThan5 = number => number > 5
const numbers = [ 2, 4, 8, 9 ]
const result = filter(isMoreThan5, numbers)
const addThree = number => number + 3
const result = map(addThree, numbers)
result
function map(transform, array) {
const initialArray = []
const mapReducer = (mappedArray, currentItem) =>
const numbers = [ 2, 4, 8, 9 ]
const addTwo = number => number + 1
const isMoreThan5 = number => number > 5
const result =
//numbers.filter(isMoreThan5)
filterArray(isMoreThan5, numbers)
//mapArray(addTwo, numbers
result
function filterArray(predicate, array) {
@mpj
mpj / client.html
Created December 12, 2019 15:01
treeproject
<style>
.buttons div {
border: 2px solid black;
margin: 10px;
padding: 1rem;
font-size: 3rem;
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
text-align: center;
}
@mpj
mpj / snake2.js
Last active December 30, 2023 03:07
<title>hello!!</title>
<canvas
name=canvas
width=300 height=300 style="border: solid 2px red">
</canvas>
<script>
canvas = document.body.children[0]
context = canvas.getContext('2d')
@mpj
mpj / afternoon.html
Last active October 25, 2019 13:13
Neural Vanilla Workshop
<html>
<!-- http://bit.ly/vanillaneural -->
<head>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<div class="legend legendX">Scariness</div>
<div class="legend legendY">Actual power</div>
<canvas id="mycanvas" width="1000" height="1000"></canvas>