Skip to content

Instantly share code, notes, and snippets.

View sejr's full-sized avatar

Sam Roth sejr

View GitHub Profile
@sejr
sejr / resume.json
Last active September 16, 2021 02:25
JSON Resume
{
"meta": {
"theme": "short"
},
"basics": {
"name": "Samuel Roth",
"label": "Programmer",
"image": "https://avatars.githubusercontent.com/u/2413031?v=4",
"email": "contact@samuelroth.net",
"url": "https://samuelroth.net",
@sejr
sejr / App.jsx
Last active March 25, 2019 15:04
Notes Example
import React, {useState} from 'react';
function Notes() {
const [newNote, setNewNote] = useState('');
const [notes, setNotes] = useState([
{
text: 'This is your first note!'
}
]);
@sejr
sejr / App.tsx
Last active September 17, 2020 08:19
Firebase Authentication with React Hooks
import React, { useState, useEffect } from 'react';
import { auth } from '../firebase';
type FirebaseUserState = firebase.User | null;
const SignIn = () => {
let [email, setEmail] = useState('');
let [password, setPassword] = useState('');
let [loading, setLoading] = useState(false);
@sejr
sejr / withFiregraph.ts
Created February 1, 2019 17:28
Firegraph comparison
export async function getPosts(): Promise<PostListItem[]> {
const { posts } = await firegraph.resolve(firestore, gql`
query {
posts {
id
body
title
author(fromCollection: "users") {
id
displayName
@sejr
sejr / hello.fe.ast
Last active January 5, 2019 03:37
This is a human-readable representation of an AST, or abstract syntax tree, for an Iron module that has been parsed by Forge.
```iron
function main {
let greeting: String = "Hello"
let target: String = " world!"
assert((greeting + target) == "Hello world!")
}
```
Module {
/// When we reach a non-alphanumeric symbol (e.g. `;`, `:`, `.`), we must treat the previous
/// current token as a finalized token and push it to our result vector accordingly. This ensures
/// that we don't come across a parsing error if someone forgets to use spaces as intended.
fn push_token(current: &mut String, result: &mut Vec<Token>, token: Token) {
if !current.is_empty() {
let current_token = Token::Identifier(current.clone());
result.push(current_token);
current.clear();
}
result.push(token);
@sejr
sejr / hello.fe
Created June 28, 2018 16:44
Example Iron program.
// Importing some standard modules.
import { io, http, json } from "@iron/standard";
/// # Documentation Comments
/// Documentation comments are comments that use Markdown to provide advanced
/// formatting features. With a single command, you can generate beautiful
/// documentation that uses these comments.
///
/// NOTE: You don't have to include param/return types; those are included.
///
<template>
<div class="section posts">
<p v-for="(post, index) in posts" :key="post.id">
{{ `${index}: ${post.data.body}` }}
</p>
</div>
</template>
<script>
import fb from '../fb'
@sejr
sejr / Parser.cc
Last active September 14, 2017 15:17
#include "Parser.h"
#include "../test/Tookit.h"
#include "../test/TestParser.h"
/**
* This is a helper function that will just iterate through every token that was
* generated in the lexical analyzer (scanner), and print it off. While this was
* more useful in earlier parts of the project, its used now only for debugging.
*/
void Parser::printTokens() {
@sejr
sejr / Display.vue
Created June 6, 2017 19:09
Display matrix
<template>
<div class="display">
<div class="row" v-for="row in display">
<span v-for="char in row" @update="refreshDisplay()">
{{ char }}
</span>
</div>
</div> <!-- .display -->
</template>