Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Coding like a madman

Matt Raible mraible

💭
Coding like a madman
View GitHub Profile
@mraible
mraible / gist:498df295e7cd8d940e42b2004ab30a83
Created May 7, 2020
pack with Heroku static buildpack
View gist:498df295e7cd8d940e42b2004ab30a83
$ pack build react-pack --builder=heroku/buildpacks --buildpack https://cnb-shim.herokuapp.com/v1/heroku-community/static
latest: Pulling from heroku/buildpacks
Digest: sha256:14c60798f3cf5bcbab867213add52d134af3aaad3064062cafb25177cd48f5ed
Status: Image is up to date for heroku/buildpacks:latest
18: Pulling from heroku/pack
Digest: sha256:a3cb71855f7e399ad079f6f0fa5feb6cc93446a332d9b8ef535ca9a17dac92cf
Status: Image is up to date for heroku/pack:18
Downloading from https://cnb-shim.herokuapp.com/v1/heroku-community/static
3.35 MB/3.35 MB
===> DETECTING
@mraible
mraible / Dockerfile
Created May 3, 2020
Dockerfile and nginx.conf that supports Angular's path-based routing
View Dockerfile
FROM node:14.1-alpine AS builder
WORKDIR /opt/web
COPY package.json package-lock.json ./
RUN npm install
ENV PATH="./node_modules/.bin:$PATH"
COPY . ./
RUN ng build --prod
@mraible
mraible / output.md
Created Apr 17, 2020
Spring Boot + OAuth 2.0 with Okta in 30 seconds
View output.md
~ curl https://start.spring.io/starter.zip -d dependencies=web,okta -d baseDir=bootiful-oauth | tar -xzvf -
cd bootiful-oauth
mvn com.okta:okta-maven-plugin:setup
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 57642  100 57598  100    44  81123     61 --:--:-- --:--:-- --:--:-- 81071
x bootiful-oauth/
x bootiful-oauth/.mvn/
x bootiful-oauth/.mvn/wrapper/
@mraible
mraible / angular-size.md
Last active Feb 12, 2020
Angular App Size
View angular-size.md

Angular 8:

  • ES5: 62 + 683 + 6.2 + 176 + 8500
  • ES2015: 50 + 264 + 6.2 + 174 + 7100

With AOT:

  • ES5: 781 + 123 + 1.5 = 905.5
  • ES2015: 664 + 36 + 1.5 = 701.5
@mraible
mraible / HomeController.java
Created Jan 16, 2020
Spring Security OIDC Demo
View HomeController.java
@RestController
class HomeController {
@GetMapping("/")
public String hello(@AuthenticationPrincipal OidcUser user) {
return "Hello, " + user.getFullName();
}
}
View search.component.spec.ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchComponent } from './search.component';
import { MockSearchService } from '../shared/search/mocks/search.service.mock';
import { MockActivatedRoute } from '../shared/search/mocks/routes';
import { SearchService } from '../shared';
import { ActivatedRoute } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
@mraible
mraible / 10m-2.16.0.html
Last active Sep 11, 2020
Add Authentication to Any Web Page in 10 Minutes
View 10m-2.16.0.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<title>Simple Web Page</title>
<style>
h1 {
margin: 2em 0;
View android.log
2019-04-14 14:23:21.362 9919-9962/com.okta.developer D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2019-04-14 14:23:21.540 9919-9994/com.okta.developer V/Capacitor/Plugin: To native (Cordova plugin): callbackId: SecureStorage1589709940, service: SecureStorage, action: init, actionArgs: ["SecretStore"]
2019-04-14 14:23:21.541 9919-9994/com.okta.developer E/SecureStorage: Device is not secure
2019-04-14 14:23:21.545 9919-9994/com.okta.developer V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 23778496, pluginId: Browser, methodName: open
2019-04-14 14:23:21.545 9919-9994/com.okta.developer V/Capacitor: callback: 23778496, pluginId: Browser, methodName: open, methodData: {"url":"https:\/\/dev-737523.oktapreview.com\/oauth2\/default\/v1\/authorize?redirect_uri=com.okta.developer%3A%2Fcallback&client_id=0oak8qpmhim2MmwF20h7&response_type=code&state=hfYUg5lbP5&scope=openid%20profile%20offline_access&code_challenge=K4jgoVyT7ckRpar6rZ2AfJ9hVY18b3H5IYX38JbMtsg&code_
@mraible
mraible / application.yml
Created Jan 10, 2019
Get an ID Token from Okta with Spring Boot
View application.yml
okta:
oauth2:
issuer: https://{yourOktaDomain}/oauth2/default
client-id: {clientId}
client-secret: {clientSecret}
You can’t perform that action at this time.