Skip to content

Instantly share code, notes, and snippets.

View c10r's full-sized avatar

Chander Ramesh c10r

View GitHub Profile
try {
const setupResult = await Auth.signUp({
username: email,
password,
attributes: {
email,
},
})
// This will fail
const code = await Auth.setupTOTP(setupResult.user)
purge: {
enabled: true, // This will *always* minify, even on dev builds
content: [
'./src/**/*.html',
'./src/**/*.js',
],
},
@c10r
c10r / webpack.config.js
Created May 27, 2020 20:27
Enable purgeCSS in webpack
const purgecss = require('@fullhuman/postcss-purgecss')({
// Specify the paths to all of the template files in your project
content: [
'./src/**/*.html',
'./src/**/*.js',
],
// Used to extract class names from your templates
defaultExtractor: content => {
// Capture as liberally as possible
const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || []
@c10r
c10r / webpack.config.js
Created May 27, 2020 20:29
Add purgeCSS to the list of style loaders
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
@c10r
c10r / kotlin-react-function error
Created April 2, 2021 23:40
Could not fetch kotlin-react-function package via gradle
Build file '/Users/chander/IdeaProjects/paintmix/build.gradle.kts' line: 1
Plugin [id: 'com.bnorm.power.kotlin-react-function', version: '0.4.0'] was not found in any of the following sources:
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
@c10r
c10r / kotlinjs firebase hosting
Created April 3, 2021 00:14
An example of Kotlin/JS deployed with Firebase hosting
{
"hosting": {
"site": "paintmix",
"public": "build/distributions/",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
@c10r
c10r / kotlinjs build failures
Created April 3, 2021 00:17
Periodic flakey build failures in KotlinJS
➜ paintmix ./gradlew build
> Task :kotlinNpmInstall
warning workspace-aggregator-26b03047-25a9-4ab1-9e54-91ef73ec87f0 > paintmix-test > mocha > debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
warning workspace-aggregator-26b03047-25a9-4ab1-9e54-91ef73ec87f0 > paintmix-test > mocha > mkdirp@0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning workspace-aggregator-26b03047-25a9-4ab1-9e54-91ef73ec87f0 > paintmix-test > mocha > chokidar > fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
warning workspace-aggregator-26b03047-25a9-4ab1-9e54-91ef73ec87f0 > paintmix > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning workspac
@c10r
c10r / apirequest.kt
Created April 3, 2021 00:29
Example of a failing API Request
data class Level(val tubes: Array<Array<String>>)
val levelJson = levelApi
.json()
.await() as Level
@c10r
c10r / apirequest.kt
Created April 3, 2021 00:33
Making an API request in kotlin/js
val levelApi = window.fetch("$BACKEND_URL?level=$level")
.await()
val levelJson = levelApi
.json()
.await()
val partialLevel: Level = levelJson.unsafeCast<Level>()
val partialTubes = JSON.parse<Array<Array<String>>>(partialLevel.tubes as String)
val newLevel = Level(partialTubes)
@c10r
c10r / firebase.kt
Created April 3, 2021 00:41
An example firebase wrapper
@JsModule("firebase")
@JsNonModule
external interface FirebaseConfig {
var apiKey: String
var authDomain: String
var databaseURL: String
var projectId: String
var storageBucket: String
var messagingSenderId: String