conventions for 3rd party modules (work in progess).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pipeable<I> { | |
constructor(public value: I) { } | |
public pipe<O>(fn: (input: I) => O) { | |
const output = fn(this.value); | |
return Object.assign(new Pipeable(output).pipe, { | |
value: output | |
}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { transform } from "https://esm.sh/sucrase"; | |
import { init, parse } from "https://unpkg.com/[email protected]/dist/lexer.js"; | |
(async () => { | |
await init; | |
const pathToAnalyze = "https://esm.sh/react"; | |
const resp = await fetch(pathToAnalyze); | |
console.log("Analyzing", resp.url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func dumpMap(space string, m map[string]interface{}) { | |
for k, v := range m { | |
if mv, ok := v.(map[string]interface{}); ok { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ROUTER | |
//Silly small javascript router to help me learn how they worked in a very simple way | |
(function (){ | |
const appDiv = "app"; | |
// Both set of different routes and template generation functions | |
let routes = {}; | |
let templates = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Detects if two elements are colliding | |
* | |
* Credit goes to BC on Stack Overflow, cleaned up a little bit | |
* | |
* @link http://stackoverflow.com/questions/5419134/how-to-detect-if-two-divs-touch-with-jquery | |
* @param $div1 | |
* @param $div2 | |
* @returns {boolean} | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WebSockets vs. Server-Sent events/EventSource | |
--------------------------------------------- | |
Both WebSockets and Server-Sent Events are capable of pushing data to browsers. To me they seem to be competing technologies. | |
What is the difference between them? When would you choose one over the other? | |
Websockets and SSE (Server Sent Events) are both capable of pushing data to browsers, however they are not competing technologies. | |
Websockets connections can both send data to the browser and receive data from the browser. | |
A good example of an application that could use websockets is a chat application. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"log" | |
"mime/multipart" | |
"net/http" | |
"os" |