Skip to content

Instantly share code, notes, and snippets.

View bonham000's full-sized avatar

Sean Smith bonham000

View GitHub Profile
@bonham000
bonham000 / conway.js
Created April 25, 2023 14:26
Reformatted some old code.
// Original code: https://github.com/bonham000/25-react-projects/tree/master/projects/Project_24
class App extends React.Component {
constructor() {
super();
this.state = {
speed: "fast",
counter: 0,
pause: false,
running: false,
randomControlValue: 3,
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
@bonham000
bonham000 / typescript-snippets.ts
Last active September 28, 2021 13:20
TypeScript Snippets
/** ===========================================================================
* TypeScript Result type!
*
* This is a Result type inspired by Rust.
*
* Reference: https://doc.rust-lang.org/rust-by-example/error/result.html
*
* The Result type allow type checking on operations which may fail, since
* in TypeScript there is no way to convey type information in functions which
* may "throw" an error.
{"claims":[{"timestamp":1578836029,"type":"ACCOUNT","address":"0x575240f049AEa7bC783F60Bebd7fCb5584a54B4A"}],"meta":{"address":"0x9abD6739153D95512D0d68eC0960d296E2F174Bc","signature":"0x642bd3122fc89b2b0c04340613423d75f8e1473e5bc063f984a3e86fbb444d8b6ea3cd56fc7813645250ea6fdb1f21a7f461a092734ed6b7f415af7591be82de1b"}}
{"claims":[{"url":"http://35.237.97.22","timestamp":1578835190,"type":"ATTESTATION_SERVICE_URL"},{"timestamp":1578835202,"type":"ACCOUNT","address":"0x9abD6739153D95512D0d68eC0960d296E2F174Bc"}],"meta":{"address":"0x575240f049AEa7bC783F60Bebd7fCb5584a54B4A","signature":"0x5c912be45d77d03526a2bb25549673923a8de763d1960198f03ade3f71edf9ae1ff388618d0a9d54cc752086a1b1f80ef4e0cba88eb6fb2304642dc5e8c3614a1b"}}
{"claims":[{"url":"http://35.237.97.22","timestamp":1578835190,"type":"ATTESTATION_SERVICE_URL"},{"timestamp":1578835202,"type":"ACCOUNT","address":"0x9abD6739153D95512D0d68eC0960d296E2F174Bc"}],"meta":{"address":"0x575240f049AEa7bC783F60Bebd7fCb5584a54B4A","signature":"0x5c912be45d77d03526a2bb25549673923a8de763d1960198f03ade3f71edf9ae1ff388618d0a9d54cc752086a1b1f80ef4e0cba88eb6fb2304642dc5e8c3614a1b"}}
{
"data": {
"user": {
"name": "Steve"
},
"posts": null,
"comments": null
},
"errors": [
{
@bonham000
bonham000 / sample-query
Created May 27, 2019 07:44
Sample GraphQL Query
query {
user {
name
}
posts {
id
text
author
}
comments {
@bonham000
bonham000 / basic-graphql-schema
Last active May 27, 2019 07:44
Sampel GraphQL Schema
type Query {
user: User
posts: [Post]
comments: [Comment]
}
type User {
id: ID!
name: String!
email: String!
type Query {
user: User
}
type User {
id: String
email: String
firstName: String
middleName: String
lastName: String