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
# This "input" configures a global authorization rule to enable public access to | |
# all models in this schema. Learn more about authorization rules here: https://docs.amplify.aws/cli/graphql/authorization-rules | |
input AMPLIFY { | |
globalAuthRule: AuthRule = { allow: public } | |
} # FOR TESTING ONLY! | |
type User | |
@model | |
@auth( | |
rules: [ | |
{ allow: groups, groups: ["Admin"] } |
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 * as React from "react"; | |
type ThemeConfig = "system" | "light" | "dark"; | |
type ThemeName = "light" | "dark"; | |
// Custom themes are keyed by a unique id. | |
type KeyedThemes = { | |
[k: string]: { | |
config: ThemeConfig; | |
themeName: ThemeName; | |
}; |
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 * as React from "react"; | |
type Theme = "system" | "light" | "dark"; | |
const STORAGE_KEY = "theme"; | |
const VALID_THEMES: Theme[] = ["system", "light", "dark"]; | |
const DARK_MODE_MEDIA_QUERY = "(prefers-color-scheme: dark)"; | |
function getAppTheme(): Theme { | |
if (typeof window !== "undefined") { |
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
Testing John Conway's [Game of Life](https://playgameoflife.com/) | |
The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves. | |
It is Turing complete and can simulate a universal constructor or any other Turing machine. |
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
{ | |
"name": "workshop-computer-validator", | |
"version": "1.0.0", | |
"description": "I use this to validate people's computers have the proper versions of node and npm installed for a workshop", | |
"bin": "./validate-system.js", | |
"dependencies": { | |
"semver": "7.1.3" | |
} | |
} |
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
Contentful Apollo Rest Data Source | |
I wrote a rest data source for one of my client's | |
project to fetch data from contentful api to | |
a graphql backend. For more information - https://www.apollographql.com/docs/apollo-server/data/data-sources/ |
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 processData(input) { | |
var input = input.split('\n'); | |
var n = parseInt(input[0]); | |
var sentences = input.slice(1, n + 1); | |
let t = parseInt(input[n+1]); | |
var words = input.slice(n+2); | |
if (words.length === t) { | |
console.log(processSentences(words, sentences).join('\n')) | |
}; |
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 HelloWorld(name) { | |
// // const this = {}; | |
// this.name = name; | |
// // return this | |
// } | |
class HelloWorld { | |
constructor(name) { | |
this.name = name.toUpperCase(); | |
} |
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
class HelloWorld { | |
constructor(name) { | |
this.name = name.toUpperCase(); | |
} | |
sayHi() { | |
console.log(`Hello ${this.name}!`) | |
}; | |
} |
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
const { GraphQLClient } = require('graphql-request'); | |
const client = new GraphQLClient('https://api.github.com/graphql', { | |
headers: { Authorization: 'token XXXX' } | |
}); | |
(async () => { | |
try { | |
const query = ` | |
{ viewer { name repositories(isFork: true, first: 10) { edges { node { createdAt name databaseId } cursor } totalCount pageInfo { endCursor startCursor hasNextPage hasPreviousPage } } } } |
NewerOlder