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
// Basics | |
type Person = { | |
name: string | |
age?: number | |
} | |
const Bob: Person = { | |
name: "Bob", | |
} |
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
// Somewhere your app | |
case class State(stuff: ...) // What your application uses to render itself | |
sealed trait AppTask extends WebWorkerTask // comes from the Granite framework | |
case class GetStuffFromAPITask(result: APIResponse = APIResponse.empty) extends AppTask | |
// Driver/Entry point for the Web App | |
object TutorialApp extends GraniteApp[State] with JSApp { | |
private val db = new LocalStorage[State]() // We want to serialize our App state to LocalStorage | |
private val dbKey = "state" // the "key" in the browser's LocalStorage object that houses our (JSON) serialized State | |
private val workers = new WebWorkerController(events, new WorkerPool(WorkerApp)) |
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
#include <stdio.h> | |
#include <pthread.h> | |
#define NUM_RECTS 1000000 | |
#define NUM_THREADS 4 | |
double gArea = 0.0; | |
pthread_mutex_t gLock; | |
void *threadFunction(void *pArg) |