Skip to content

Instantly share code, notes, and snippets.

import React, { useState, useEffect, createContext, useContext, ReactNode } from 'react'
import Amplify, { Auth, Hub } from 'aws-amplify'
import { CognitoUser } from '@aws-amplify/auth'
import { CognitoUserSession } from 'amazon-cognito-identity-js'
import { HubCallback } from '@aws-amplify/core/lib/Hub'
import IUser from '../../types/IUser'
interface IAuthContext {
user: IUser | null
login(username: string, password: string): Promise<CognitoUser>

CSS properties that trigger layout

  1. border, border-collapse, border-width
  • box-sizing
  • float
  • font, font-family, font-size, font-weight, line-height
  • height
  • letter-spacing
  • margin
  • max-height
@groundedsage
groundedsage / build.clj
Created June 19, 2018 02:43 — forked from robert-stuttaford/build.clj
Basic nREPL / cljs compile / cljs repl / figwheel script for use with clj cli command: `clj build.clj TASK`
(require '[cljs.build.api :as api]
'[clojure.string :as string]
'[figwheel-sidecar.repl-api :as figwheel]
'[figwheel-sidecar.components.nrepl-server :as figwheel.nrepl])
(def source-dir "src")
(def compiler-config
{:main 'app.main
:output-to "target/app.js"
(ns code.server-render
(:require
[clojure.string :as str]
[cljss.builder :as cljss])
(:import
[clojure.lang IPersistentVector ISeq Named Numbers Ratio Keyword]))
(defn nothing? [element]
(and (vector? element)
@groundedsage
groundedsage / react-native-stylesheet.cljs
Created March 30, 2018 12:44 — forked from roman01la/react-native-stylesheet.cljs
Access React Native compiled styles map using Clojure's keywords.
(def stylesheet (.-StyleSheet ReactNative))
(defn create-stylesheet [styles]
(->> styles
(clj->js)
(.create stylesheet)
(js->clj)
(clojure.walk/keywordize-keys)))
; usage
@groundedsage
groundedsage / skeleton.js
Created August 24, 2017 06:13 — forked from liammclennan/skeleton.js
Node.js console application skeleton
if (process.argv.length < 3) {
console.log('Usage: node ' + process.argv[1] + ' FILENAME');
process.exit(1);
}
var fs = require('fs')
, filename = process.argv[2];
let input = fs.readFileSync(filename, 'utf8');
@groundedsage
groundedsage / analytics.cljs
Created February 16, 2017 23:25 — forked from andrewsuzuki/analytics.cljs
clojurescript google analytics autotrack
(ns MY_NAMESPACE.analytics
(:require [cljsjs.google-analytics]
[autotrack]))
(def tracking-code "UA-XXXXX-Y")
(defn start []
(js/ga "create" tracking-code "auto")
(js/ga "require" "autotrack")
(js/ga "send" "pageview"))
(ns xzs.utils.styler
"
A macro namespace that generates classes on the fly for usage in cljs.
# Motivation
https://ryantsao.com/blog/virtual-css-with-styletron
# Synopsis:
In your cljs files:
(set-env! :source-paths #{"src"})
(require '[boot.core :as core]
'[boot.util :as util]
'[clojure.java.io :as io])
(core/deftask string-template
"Does the thing"
[f template-file VALUE str "Name of the template file to use"
t target-file VALUE str "Name of the output file to produce"