Skip to content

Instantly share code, notes, and snippets.

@timbophillips
timbophillips / Hasura Migration.md
Last active February 7, 2022 04:22
Hasura Migration

My notes on migration

Only have to do this bit the first time

hasura init data-cli --endpoint http://localhost:8081 --admin-secret hello-this-is-my-admin-secret
cd data-cli/
hasura migrate create "init" --from-server --database-name default
hasura migrate apply --skip-execution --version <version-number-from-prev-migrate-command> --database-name default
hasura metadata export

Every other time start here

@timbophillips
timbophillips / download heroku psql database.bash
Created February 21, 2021 13:03
download / backup a Heroku cloud postgresql database to a *text* psql file
#!/bin/bash
HEROKU_APP_NAME=app-name
OUTPUT_SQL_FILENAME=~/Downloads/myDB.psql
heroku pg:backups:capture --app $HEROKU_APP_NAME
heroku pg:backups:download --app $HEROKU_APP_NAME
pg_restore ./latest.dump -f $OUTPUT_SQL_FILENAME
npm init
npm i -D typescript@next ts-node nodemon dotenv eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin prettier eslint-config-prettier eslint-plugin-prettier
npx tsc --init
mkdir src dist
echo "const writeMessage = (message: string) => { console.log(message); }; writeMessage('TS app on Node JS');" >> src/app.ts
cat << EOF
Now make the following modifications to tsconfig.
{
"compilerOptions": {
import { NgModule } from '@angular/core';
import { APOLLO_OPTIONS } from 'apollo-angular';
import {
ApolloClientOptions,
InMemoryCache,
split,
ApolloLink,
} from '@apollo/client/core';
import { HttpLink } from 'apollo-angular/http';
import { WebSocketLink } from '@apollo/client/link/ws';
@timbophillips
timbophillips / howto.txt
Created April 10, 2020 09:27
building angular packages and using them pre-publish
https://angular.io/guide/creating-libraries
in angular.json of the project calling the angular lib via the link
projects.$name.architect.build.options.preserveSymlinks: true
use npm link in the library project
https://docs.npmjs.com/cli/link.html
@timbophillips
timbophillips / useful_sites.txt
Last active April 4, 2020 01:56
codegen angular apollog hasura graphql
https://github.com/dotansimha/graphql-code-generator/issues/2043
https://medium.com/angular-in-depth/configuring-a-angular-cli-project-with-graphql-37217f66d419
https://github.com/dotansimha/graphql-code-generator/issues/2043#issuecomment-508540316
@timbophillips
timbophillips / angular.json
Created November 16, 2019 23:49
modification to after ng add apollo-angular to include websockets and proxy (in this case with a local hasura server)
......
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "apollo-hasura-learning:build",
"proxyConfig": "src/proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "apollo-hasura-learning:build:production"
@timbophillips
timbophillips / Generate-Github-SSH-key.ps1
Created October 27, 2019 02:38
Adding a new SSH key to your GitHub account - using PowerShell on Windows
Write-Host "
This script performs the steps from
https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
1. generate a ssh key
2. start the ssh-agent service
3. add the key to the agent
4. copy the public key signaturecopy it to the clipboard
@timbophillips
timbophillips / angular.json
Last active October 3, 2019 12:58
Fix CORS problem using Angular (Webpack) proxy - this redirects /api to localhost:8888
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "eaglebayng:build",
"proxyConfig": "src/proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "eaglebayng:build:production"
}
@timbophillips
timbophillips / local-fonts-icons-angular
Created January 1, 2019 00:44
host roboto font and material icons locally in angular app
//// npm install --save roboto-fontface material-icons
//// put the below stuff into src/styles.scss
// for npm roboto-fontface package (to load local files)
$roboto-font-path: "~roboto-fontface/fonts" !default;
@import "~roboto-fontface/css/roboto/sass/roboto-fontface";
// for npm material-icons package (to load local files)
$material-icons-font-path: '~material-icons/iconfont/';