Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Kevin Grüneberg kevcodez

🚀
View GitHub Profile
@kevcodez
kevcodez / auth0-rule.js
Created Jun 27, 2022
Auth0 notify backend on social auth "registration"
View auth0-rule.js
async function (user, context, callback) {
const axios = require('axios');
const isSocial = context.connectionStrategy === context.connection;
// if it is the first login (hence the `signup`) and it is a social login
if (context.stats.loginsCount === 1 && isSocial) {
let loginMethod = '';
const connectionName = user.identities[0].provider.toLowerCase();
@kevcodez
kevcodez / hook.sql
Created Apr 30, 2022
Supabase Before insert hook
View hook.sql
-- Create a new trigger
CREATE OR REPLACE FUNCTION public.notify_parqet_api_signup()
RETURNS TRIGGER AS $$
DECLARE
parqet_user_id varchar;
social_provider_id varchar;
BEGIN
-- Extract ID from social provider, can be null
social_provider_id := NEW.raw_user_meta_data->>'provider_id';
View gist:90e5774f3d0695d1f2b9db78abb87548
function doYourStuff() {
const yourString = "foobar"
const uniqueString = findUniqueString(yourString)
// continue with your logic with unique string
}
function findUniqueString(baseString) {
let uniqueString = baseString
// number of iterations should be super small, probably unnecessary to have a max threshold
@kevcodez
kevcodez / gist:512ab3b368b5d690d925d30e00d7fec6
Created Mar 17, 2021
register custom components in nuxt
View gist:512ab3b368b5d690d925d30e00d7fec6
import { join } from "path";
export default function () {
const { nuxt } = this
// Make sure components is enabled
if (!nuxt.options.components) {
throw new Error('please set `components: true` inside `nuxt.config` and ensure using `nuxt >= 2.13.0`')
}
@kevcodez
kevcodez / settings.json
Created Jan 9, 2021
Nuxt Config + Github Pages
View settings.json
{
...
"logo": {
"light": "/<repo-name>/logo-light.svg",
"dark": "/<repo-name>/logo-dark.svg"
},
...
}
@kevcodez
kevcodez / nuxt.config.js
Created Jan 9, 2021
Nuxt Config + Github Pages
View nuxt.config.js
export default theme({
// ...
router: {
base: '/<repo-name>/'
}
})
@kevcodez
kevcodez / docs.yml
Last active Jan 12, 2021
Github Pages + Nuxt Content Deploy
View docs.yml
name: docs
# define the trigger
on: [push, pull_request]
jobs:
docs:
runs-on: ${{ matrix.os }}
env:
# We used "docs" as directory name for our documentation, we will be referencing this later
@kevcodez
kevcodez / gist:0fa6f561315e73c26748dc847e32f113
Created Jun 7, 2020
OAuth 2.0 PKCE Flow with AWS Cognito - Login with public client, like CLI
View gist:0fa6f561315e73c26748dc847e32f113
import {
Issuer,
generators,
Client,
TokenSet,
CallbackParamsType,
} from "openid-client";
const http = require('http');
const issuer = await Issuer.discover('https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_VqitD3cvk/.well-known/openid-configuration')
View jacocoTestCoverage.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.0//EN"
"report.dtd">
<report name="pubg-api-wrapper">
<sessioninfo id="Kevins-MacBook-Pro.local-aeb34bc9" start="1534702636504" dump="1534702652857"/>
<sessioninfo id="Kevins-MacBook-Pro.local-88d710fc" start="1534704720654" dump="1534704745021"/>
<package name="de/kevcodez/pubg/model/status">
<class name="de/kevcodez/pubg/model/status/Status">
<method name="getReleasedAt" desc="()Ljava/time/Instant;" line="12">
<counter type="INSTRUCTION" missed="7" covered="0"/>
<counter type="BRANCH" missed="2" covered="0"/>
@kevcodez
kevcodez / build.gradle
Last active Nov 4, 2018
Working build script - Jacoco Code Coverage with Kotlin and Gradle 4.9 and Junit 5
View build.gradle
buildscript {
ext {
kotlin_version = '1.2.71'
junit_version = '5.3.1'
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}