Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniele Zurico daniele-zurico

View GitHub Profile
View footer.tsx
View final.tsx
import React from 'react';
interface ThemeProps {
color: string;
backgroundColor: string;
}
interface Theme {
theme: ThemeProps;
}
View newContext.tsx
import React from 'react';
interface ThemeProps {
color: string;
backgroundColor: string;
}
interface Theme {
theme: ThemeProps;
}
View ThemeContext.tsx
import React from 'react';
enum Actions {
LIGHT = 'light',
DARK = 'dark',
BROWN = 'brown',
}
interface ThemeProps {
color: string;
View ngx-data-table-datasource.ts
import { DataSource } from '@angular/cdk/collections';
import { MatPaginator, MatSort } from '@angular/material';
import { map } from 'rxjs/operators';
import { Observable, of as observableOf, merge } from 'rxjs';
/**
* Data source for the NgxDataTable view. This class should
* encapsulate all logic for fetching and manipulating the displayed data
* (including sorting, pagination, and filtering).
*/
View index.js
import React from 'react'
import {Rule} from '@cesium133/forgjs'
interface Validation {
rule: any
message: string
}
const useValidation = (value: string, validation: Validation) => {
const [validity, setValid] = React.useState({valid: true, message: ''})
View index.js
const {gql} = require('apollo-server');
const typeDefs = gql`
extend type Query {
book(id: ID!): Book
books: [Book]
}
type Book {
id: ID!
title: String
author: Author
View index.js
const {gql} = require('apollo-server');
const typeDefs = gql`
extend type Query {
author(id: ID!): Author
authors: [Author]
}
type Author {
id: ID!
name: String
surname: String
View index.js
const {ApolloServer} = require('apollo-server');
const server = new ApolloServer({
modules: [
require('./modules/author'),
require('./modules/books')
]
})
server
.listen()
.then(({url}) => console.log(`server is running at ${url}`));
View author.js
type Book {
title: String
author: Author
}
type Author {
name: String
books: [Book]
}