Skip to content

Instantly share code, notes, and snippets.

View ConorCorp's full-sized avatar

Conor ConorCorp

View GitHub Profile
@ConorCorp
ConorCorp / middleware.js
Created September 12, 2021 10:40
Basic browsersync middleware example
// require the module as normal
var bs = require("browser-sync").create();
// .init starts the server
bs.init({
files: "dist/css/*.css, dist/js/*.js, **/*.html, !node_modules/**/*.html",
server: true,
browser: "firefox",
middleware: function(req, res, next) {
console.log(req.url)
@ConorCorp
ConorCorp / .zshrc
Last active January 18, 2024 11:39
My .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"
@ConorCorp
ConorCorp / linkIOSSubs.jsx
Created September 30, 2022 11:44
React Native: Link to iOS subscriptions (in app purchases)
import {
Linking
} from 'react-native';
Linking.openURL('itms-ui://');
// Other iOS deep links (universal links) https://medium.com/@contact.jmeyers/complete-list-of-ios-url-schemes-for-apple-apps-and-services-always-updated-800c64f450f
#! /bin/sh
# Run this with
# curl -s https://gist.githubusercontent.com/ConorCorp/ac7ef3fe50b9c92593662a7cf7e3b1d0/raw/new-pc-setup.sh | zsh
echo "---- Running Computer Setup 👾"
echo "---- Setting Zsh as default"
zsh --version
chsh -s $(which zsh) || exit 1
@ConorCorp
ConorCorp / loadSchemaIntoFileFromUrl.ts
Created June 27, 2023 13:19
Load a schema with `@graphql-tools/url-loader` from a url, into a file.
import { loadSchema } from '@graphql-tools/load';
import { UrlLoader } from '@graphql-tools/url-loader';
import { writeFile } from 'fs';
import { printSchema } from 'graphql';
/*
* Script that loads cms's graphql schema from localhost instance.
*
* See docs here: https://the-guild.dev/graphql/tools/docs/schema-loading
*/
@ConorCorp
ConorCorp / how-to-copy-aws-rds-to-local.md
Last active February 14, 2024 16:32 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to access the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
    • Make sure rds has Publicly Accessible checked. This can be done/undone immediately without db downtime.
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
  • $ psql -U -d -f
@ConorCorp
ConorCorp / @foal+core+4.4.0.patch
Created July 15, 2024 15:35
Another Patch for foal which now adds typing for query params as well.
diff --git a/node_modules/@foal/core/lib/core/http/context.d.ts b/node_modules/@foal/core/lib/core/http/context.d.ts
index 4042055..e0f2dc2 100644
--- a/node_modules/@foal/core/lib/core/http/context.d.ts
+++ b/node_modules/@foal/core/lib/core/http/context.d.ts
@@ -24,10 +24,10 @@ interface IncomingMessage extends Readable {
*
* @interface Request
*/
-interface Request extends IncomingMessage {
+export interface Request<body = any, params = any, query = any> extends IncomingMessage {