Skip to content

Instantly share code, notes, and snippets.

View dapperAuteur's full-sized avatar
🏠
teach what's been taught.

dapperAuteur dapperAuteur

🏠
teach what's been taught.
View GitHub Profile
@dapperAuteur
dapperAuteur / layout.js & login.js
Created June 26, 2023 20:47
NextJS Styles not working as expected. This gist includes two files and a description.
// first file is layout.js
// authapp/components/layout.js
import styles from "./../../styles/Layout.module.css"
export default function Layout({children}) {
return (
<div className="flex h-screen bg-blue-400">
<div className="m-auto bg-slate-50 rounded-md w-3/5 h-3/4 grid lg:grid-cols-2">
<div className={styles.imgStyle}>
<div className={styles.cartoonImg}></div>
@dapperAuteur
dapperAuteur / auth.go
Last active March 24, 2021 03:09
Gist Help ERROR MESSAGE: 45:23: cannot use lookup (type func(string) (*rsa.PublicKey, error)) as type auth.PublicKeyLookup in argument to auth.New
// Package auth provides authentication and authorization support.
package auth
import (
"crypto/rsa"
"github.com/dgrijalva/jwt-go"
// "github.com/dgrijalva/jwt-go/v4"
"github.com/pkg/errors"
)
@dapperAuteur
dapperAuteur / filter products
Created September 19, 2020 00:06
This gist contains the model, service, handler, and route to filter products
// model
// FilterProduct defines what information may be provided to make a request to get Products and filter the results.
// All fields are optional so clients can send just the fields they want changed.
// It uses pointer fields so we can differentiate between a field that was not provided and a field that was provided as explicitly blank.
// Normally we do not want to use pointers to basic types but we make exceptions around marshalling/unmarshalling.
type FilterProduct struct {
Name *string `json:"name"`
Cost *int `json:"cost" validate:"omitempty,gte=0"`
Quantity *int `json:"quantity" validate:"omitempty,gte=1"`
package main
import (
"context"
"crypto/rsa"
_ "expvar" // Register the expvar handlers
"fmt"
"io/ioutil"
"log"
"net/http"
import React from "react"
const cardStyles = {
display: "flex",
flexDirection: "column",
justifyContent: "space-around",
alignItems: "flex-start",
padding: "1rem",
marginBottom: "1rem",
boxShadow: "5px 5px 25px 0 rgba(46,61,73,.2)",
backgroundColor: "#fff",
@dapperAuteur
dapperAuteur / Skus.js
Created September 27, 2019 00:47
stripe skus
import React, { Component } from "react"
import { graphql, StaticQuery } from "gatsby"
import SkuCard from "./SkuCard"
const containerStyles = {
display: "flex",
flexDirection: "row",
flexWrap: "wrap",
justifyContent: "space-between",
padding: "1rem 0 1rem 0",
}
@dapperAuteur
dapperAuteur / guessNotWinningWord
Created July 29, 2019 15:33
An ok time to use a nested for loop.
/* This code sample exemplifies an important aspect of your coding philosophy for many reasons.
* In most cases it's not a good idea to nest for loops.
* In this unique case it's ok because the object(s) being looped will always have a length of 4.
* My coding philosophy is similar to my life philosophy, everything depends on the event it's applied to.
* There are few hard and fast rules. Read the room and make a decision.
* Another way in which this code sample exemplifies my coding philosophy is that the function rewards the player for effort.
* This code is part of a game that asks the player to guess a four letter word. The player may receive points for wrong answers.
*
*
*/
@dapperAuteur
dapperAuteur / DefaultState.js
Created April 22, 2019 20:44
react with hooks
import React, { useReducer } from "react";
import * as actionTypes from "./actionTypes";
export const matchInitialState = {
currentUser: {},
endpoint: "localhost:4001",
// endpoint: "http://192.168.0.4:4001",
match: {
scoreKeeper: "",
homeTeam: "5c9a9ef3e6814f122a1af324",
@dapperAuteur
dapperAuteur / matchReducer.js
Created April 22, 2019 20:43
react using hooks
import {
UPDATE_MATCH,
INCREMENT_HOME_SCORE,
INCREMENT_AWAY_SCORE,
INCREMENT_BALLS,
INCREMENT_STRIKES,
INCREMENT_FOULS,
INCREMENT_OUTS,
INCREMENT_CURRENT_INNING,
CREATE_NEW_MATCH,
@dapperAuteur
dapperAuteur / LeagueController.java && LeagueRepository.java
Last active April 2, 2019 17:52
this is the controller and repository
package com.intraedge.project.prok.controllers;
import java.util.List;
import javax.validation.Valid;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;