root
├── core - core application logic. Things in here have no knowledge of stores nor interaction ingress/egress
│ ├── entities.ts -- domain entities shared throughout the core logic
│ └── someFn.ts -- some (probably pure) function that does some business logic.
├── store
│ ├── SqlStore.ts -- given a DB connection, issues queries and returns plain 'old objects. You could also go nuts and define these as interfaces alongside concrete instances to allow for mocked instances in tests or pre-prod envs.
│ └── ObjectStore.ts -- given object store client, issues requests to CRUD files, returns plain 'old objects
This file contains 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
type Result<T, E = Error> = | |
| { ok: true; value: T } | |
| { ok: false; error: E }; | |
function wrap<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => Result<ReturnType<T>> { | |
return function(...args: Parameters<T>): Result<ReturnType<T>> { | |
try { | |
const value = fn(...args); | |
return { |
This file contains 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 { | |
ConnectRouter, | |
ConnectRouterOptions, | |
createConnectRouter, | |
} from "@bufbuild/connect"; | |
import type { UniversalHandler } from "@bufbuild/connect/protocol"; | |
import { createFetchHandler, FetchHandler } from "./fetch-universal-handler"; // https://gist.github.com/timostamm/5ca423155a0ddf03678ddc61f08cf4bd | |
interface NextJs13ApiRouterOptions extends ConnectRouterOptions { | |
/** |
This file contains 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
ch := make(chan *nats.Msg, 64) | |
_, err = nc.ChanSubscribe("insights.get.velocity", ch) | |
if err != nil { | |
panic(err) | |
} | |
go func() { | |
for { | |
msg := <-ch | |
fmt.Print("Receiving in channel: ") |
This file contains 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 tkinter | |
def main(): | |
root = tkinter.Tk() | |
canvas = tkinter.Canvas(root, width=200, height=100) | |
canvas.pack() | |
button = tkinter.Button(root, text="test") | |
button.bind("<Button-1>", lambda e: print("left clicked")) | |
button.bind("<Button-2>", lambda e: print("right clicked")) # Should print "right clicked" to the console. Change it to <Button-3> and it won't work | |
button.pack() |
Create React App does not provide watching build mode oficially (#1070).
This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.
Create a React app.
Put the script into scripts/watch.js
.
I hereby claim:
- I am jasonblanchard on github.
- I am aboutblank (https://keybase.io/aboutblank) on keybase.
- I have a public key ASDzal-YgJh2hplpuC2K_pBpr8gEczosOfkUyEfO-f6wIAo
To claim this, I am signing this object:
This file contains 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
function createPerson(attribute) { | |
var attributes = [attribute]; | |
return function inner(attribute) { | |
if (!attribute) { | |
return attributes; | |
} | |
attributes.push(attribute); | |
- NYCDA - Check out the other evening courses at NYCDA - https://nycda.com/courses?q=part-time-classes. If you are interested, let Zach Feldman know so they can figure out enrollment.
- Code School https://www.codeschool.com/ - a good place to start getting a bigger picture of Web dev ecosystem. Includes many of the technologies listed below.
- JavaScript: The Good Parts http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742 - great overview of the JavaScript language.
- You Don't Know JS https://github.com/getify/You-Dont-Know-JS - Fantastic deeper dive into the JavaScript language including ES6.
Most complex Web applications use a front-end JavaScript framework to help manage the complexity of rich UIs. As you get more comfortable with JS, definitely check out these:
This file contains 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
function createRunOnce() { | |
var hasRun = false; | |
return function() { | |
if (hasRun === false) { | |
console.log('I have run'); | |
hasRun = true; | |
} | |
}; | |
} |
NewerOlder