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
export interface HttpResponse<T> { | |
data: T; | |
url: string; | |
status: number; | |
} | |
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE"; | |
export type HttpHaders = { [key: string]: string }; | |
export type QueryParams = { [key: string]: string }; | |
export type HttpBody = Document | XMLHttpRequestBodyInit | null; |
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
// Adding some styles with transitions | |
const style = document.createElement('style'); | |
const initialScale = 0.4; | |
style.innerHTML = ` | |
portal { | |
position:fixed; | |
width: 100%; | |
height: 100%; | |
opacity: 0; | |
transition: |
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 { h, Component } from 'preact'; | |
import classy from 'classnames'; | |
export default class Image extends Component { | |
state = { | |
src: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7', | |
dataSrc: false, | |
loaded: false | |
} |
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 Koa from 'koa'; | |
import * as serve from 'koa-static'; | |
import { readFileSync } from 'fs'; | |
import { join } from 'path'; | |
// the middileware universal.ts | |
// https://gist.github.com/ashokvishwakarma/7c97578108e49fb38d06777e8319bb24 | |
import universal from './universal'; |
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 { Context } from 'koa'; | |
import { renderModuleFactory } from '@angular/platform-server'; | |
import { enableProdMode } from '@angular/core'; | |
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader'; | |
import { readFileSync } from 'fs'; | |
import { join } from 'path'; | |
const { |
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
// Types | |
type Person { | |
id: ID! | |
name: String | |
children( | |
first: Int | |
after: Int | |
filter: PersonFilter | |
): [Person!]! | |
parents( |
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 { Injectable } from '@angular/core'; | |
import { Apollo } from 'apollo-angular'; | |
import { | |
QUERY_USERS, | |
MUTATION_LOGIN, | |
SUBSCRIPTION_POST | |
} from './graphql'; | |
@Injectable({ |
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 { NgModule } from '@angular/core'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { Subscription } from 'rxjs'; | |
import { ApolloModule, Apollo } from 'apollo-angular'; | |
import { InMemoryCache } from 'apollo-cache-inmemory'; | |
import { setContext } from 'apollo-link-context'; | |
import { onError } from 'apollo-link-error'; | |
import { ApolloLink, split } from 'apollo-link'; | |
import { HttpLink } from 'apollo-link-http'; |
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
#!/bin/bash | |
CLEAN="clean" | |
RUN="run" | |
STOP="stop" | |
if [ "$#" -eq 0 ] || [ $1 = "-h" ] || [ $1 = "--help" ]; then | |
echo "Usage: ./myapp [OPTIONS] COMMAND [arg...]" | |
echo " ./myapp [ -h | --help ]" | |
echo "" |
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
# Install node v10 | |
FROM node:10 | |
# Set the workdir /var/www/myapp | |
WORKDIR /var/www/myapp | |
# Copy the package.json to workdir | |
COPY package.json ./ | |
# Run npm install - install the npm dependencies |
NewerOlder