Skip to content

Instantly share code, notes, and snippets.

View AnalyticsListenerContext.tsx
import React from 'react'
// We use lodash to transform the label name, if you don't have lodash, you could either install it, remove that part, or implement your own version of camel case.
import camelCase from 'lodash/camelCase'
export type AnalyticsListenerContextValue = {
// When manually calling stopPropagation, we want to make sure we still capture analytics so prefer using stopPropagation from this provider instead of calling event.stopPropagation directly.
stopPropagation: (
| React.KeyboardEvent
| MouseEvent
View gist:a91f870c38d0da9bf7ed90c63d4748d5
kant01ne / page.screen.code-snippets
Created February 19, 2021 10:38
VSCode page.screen.code-snippets
View page.screen.code-snippets
// Place your supertokens-auth-react workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"Comment Block": {
View supertokens-nextjs-demo.pages.index.js
import React, {useEffect, useState} from "react";
import Head from 'next/head';
import 'regenerator-runtime/runtime';
import styles from '../styles/Home.module.css'
import {doesSessionExist} from 'supertokens-auth-react/recipe/session';
import { signOut } from "supertokens-auth-react/recipe/emailpassword";
export default function Home() {
const [hasSession, setHasSession] = useState(false);
View supertokens-nextjs-demo.pages.api.auth.[[...path]].js
// Next.js API route support:
import SuperTokens from "supertokens-node";
import Session from "supertokens-node/recipe/session";
import EmailPassword from "supertokens-node/recipe/emailpassword";
import Cors from 'cors';
const apiPort = process.env.APP_PORT || 3000;
const apiDomain = process.env.APP_URL || `http://localhost:${apiPort}`;
const websitePort = process.env.APP_PORT || 3000;
const websiteDomain = process.env.APP_URL || `http://localhost:${websitePort}`
View supertokens-nextjs-demo.pages.auth.[[...path]].js
import Head from 'next/head';
import React, { useEffect } from 'react';
import 'regenerator-runtime/runtime';
import styles from '../../styles/Home.module.css';
import dynamic from 'next/dynamic';
import SuperTokens from 'supertokens-auth-react';
const SuperTokensComponentNoSSR = dynamic(() => import('supertokens-auth-react').then(mod => {
return () => mod.getRoutingComponent() || null;
}), {
View supertokens-nextjs-demo.pages._app.js
import '../styles/globals.css';
import React from "react";
import 'regenerator-runtime/runtime';
import SuperTokens from 'supertokens-auth-react';
import EmailPassword from 'supertokens-auth-react/recipe/emailpassword';
import Session from 'supertokens-auth-react/recipe/session';
const websitePort = process.env.APP_PORT || 3000;
const websiteUrl = process.env.NEXT_PUBLIC_APP_URL || `http://localhost:${websitePort}`;
View components.conversations-parts-dropdown-item.js
import Ember from 'ember';
export default Ember.Component.extend({
click() {
View components.create-segment-modal.js
import Ember from 'ember';
export default Ember.Component.extend({
hasName: Ember.computed.notEmpty('name'),
actions: {
log(message) {