Skip to content

Instantly share code, notes, and snippets.

View theoomoregbee's full-sized avatar
👀

Theophilus Omoregbee theoomoregbee

👀
View GitHub Profile
@theoomoregbee
theoomoregbee / server.js
Last active November 10, 2020 13:58
Graphql explorer nodejs server
const express = require('express');
const { graphqlHTTP } = require('express-graphql');
const { loadSchema } = require('@graphql-tools/load');
const { JsonFileLoader } = require('@graphql-tools/json-file-loader');
const app = express();
// yarn codegen (with introspection plugin) must run first so ./graphql.schema.json is available to use here
loadSchema('./graphql.schema.json', {
loaders: [new JsonFileLoader()],
@theoomoregbee
theoomoregbee / Weather.tsx
Created November 9, 2020 04:30
Retrieve weather using graphql custom hooks
import React from "react";
import { useGetCityByNameQuery } from "../generated/graphql";
const Weather = () => {
const { data, loading, error } = useGetCityByNameQuery({
variables: {
name: "Toronto",
},
});
@theoomoregbee
theoomoregbee / get-links-within-html-doc.js
Created September 18, 2020 18:14
Get all the links within a HTML page
@theoomoregbee
theoomoregbee / get-unique-query-params-from-links.js
Last active September 18, 2020 19:12
Get unique url query string params and how many times they showed up
@theoomoregbee
theoomoregbee / .travis.yml
Last active December 19, 2019 12:34
travis s3-deployed-ci-app
language: node_js
node_js:
- '8'
before_cache:
# awss3-deploy
- pip install --user awscli
before_deploy:
- export BUCKET=s3-deployed-app LOCAL_DIR=build
- npm run build
@theoomoregbee
theoomoregbee / .gitlab-ci.yml
Last active December 19, 2019 12:35
gitlab s3-deployed-ci-app
image: node:8
cache:
paths:
- node_modules/
before_script:
- apt-get update
- apt-get install -y -qq python3-dev python3-pip
- pip3 install --upgrade awscli
@theoomoregbee
theoomoregbee / role-guard.service.ts
Created August 3, 2018 04:39
Role guard for guard post
import { AuthService } from './../services/auth.service';
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router, Route } from '@angular/router';
import { Observable } from 'rxjs';
@Injectable()
export class RoleGuard implements CanActivate {
constructor(private _authService: AuthService, private _router: Router) {
@theoomoregbee
theoomoregbee / auth-guard.service.ts
Last active July 29, 2018 21:03
Auth guard for guard post
import { AuthService } from './../services/auth.service';
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router, Route } from '@angular/router';
import { Observable } from 'rxjs';
@Injectable()
export class AuthGuard implements CanActivate {
constructor(private _authService: AuthService, private _router: Router) {
@theoomoregbee
theoomoregbee / app.modules.ts
Created July 29, 2018 13:58
Using route guard post
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { LoginComponent } from './login/login.component';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
import { APP_ROUTES } from './app.routes';
import { DashboardModule } from './dashboard/dashboard.module';
@theoomoregbee
theoomoregbee / dashboard.routes.ts
Last active July 29, 2018 13:56
Dashboard routes for route guard post
import { Routes } from '@angular/router';
import { LayoutComponent } from './layout/layout.component';
import { HomeComponent } from './home/home.component';
import { AdminComponent } from './admin/admin.component';
export const dashboardRoutes: Routes = [
{
path: 'dashboard',
component: LayoutComponent,
children: [