I hereby claim:
- I am thomasfoster96 on github.
- I am thomasfoster96 (https://keybase.io/thomasfoster96) on keybase.
- I have a public key ASDCAbD60YhJmYb8J9dRvtrYNFA_qnfxOv5nmjaKtgakZwo
To claim this, I am signing this object:
// ⚠️ This is NOT the React Hooks API | |
const key = Symbol(); | |
function Form() { | |
// ... | |
const name = useFormInput(key, "name"); | |
const surname = useFormInput(key, "surname"); | |
// ... | |
return ( |
I hereby claim:
To claim this, I am signing this object:
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="./styles.css"> | |
</head> | |
<body> | |
<div id="map">Hello World!</div> | |
</body> | |
</html> |
Generated using http://github.com/rbuckton/grammarkdown
SourceCharacter ::
any Unicode code point
InputElementDiv ::
WhiteSpace
LineTerminator
Comment
function transpile(token){ | |
switch(token.type){ | |
case "Literal": | |
switch(typeof token.value){ | |
case "string": | |
return `"${token.value}"`; | |
case "boolean": | |
return `${token.value ? "true" : "false"}`; | |
case "null": | |
return "nothing"; |
/* Template string as function. | |
* | |
* Pros: Only has access to parameters. | |
* Cons: Have to make a module. | |
*/ | |
import {template} from './template-string-as-function.js'; | |
let page = template({ | |
title: "10 Wierd Template String Tricks", |
class Graph { | |
adjList = new Map() | |
constructor(iterable, directed = true){ | |
for(let node of iterable){ | |
this.adjList.set(node, new Map()); | |
} | |
} | |
// This gist plays around with a subset of ECMAScript6 (ES2015) that only uses expressions (except for the 'Program' const declaration). | |
/* Some rules: | |
* Arrow functions that evaluate an expression are the only kinds of functions allowed. | |
* All variables are declared as function parameters. | |
* If you want to scope variables, use the following format of an arrow function in parentheses: | |
((variables,to,declare,in,function,scope)=>(expressions,within,which,you,will,use,said,variables))() | |
* No return statement - the last expression in a list of expressions is what is returned. | |
* No Generators :( Or async/await :( |
/* | |
* The until version of doWhileLoop. | |
*/ | |
function untilLoop(condition, body){ | |
if(!condition()){ | |
body(); | |
return untilLoop(condition,body); | |
}else{ | |
return; |