Skip to content

Instantly share code, notes, and snippets.

call plug#begin()
Plug 'drewtempelmeyer/palenight.vim'
Plug 'vim-airline/vim-airline'
Plug 'wlangstroth/vim-racket'
Plug 'sheerun/vim-polyglot'
Plug 'rust-lang/rust.vim'
Plug 'preservim/tagbar'
Plug 'universal-ctags/ctags'
Plug 'luochen1990/rainbow'
Plug 'itchyny/lightline.vim'
import React from 'react';
import { useRecoilState } from 'recoil';
import { someTextState } from './state.js';
function SomeComponent() {
const [someText, setSomeText] = useRecoilState(someTextState);
const onChange = (event) => {
setSomeText(event.target.value);
};
import { atom } from 'recoil';
export const someTextState = atom({
key: 'someTextState',
default: ''
});
import React from 'react';
import { RecoilRoot } from 'recoil';
import SomeComponent from './somecomponent.js';
function App() {
return (
<RecoilRoot>
<SomeComponent />
</RecoilRoot>
);
@tcaer
tcaer / server.js
Last active April 14, 2020 04:48
The callback route
const CLIENT_ID = process.env.CLIENT_ID;
const CLIENT_SECRET = process.env.CLIENT_SECRET;
const REDIRECT = process.env.DISCORD_CALLBACK_URI;
app.get('/discord/callback', async function(req, res) {
// We must check to ensure that a code was provided for us to use
if (!req.query.code) res.send('No code provided!');
const code = req.query.code;
// We will now create the credentials we will use to get our access and refresh tokens
@tcaer
tcaer / server.js
Last active April 14, 2020 04:21
Shows the login route
const DISCORD_SIGNIN_LINK = process.env.DISCORD_SIGNIN_LINK;
app.get('/login', function(req, res) {
res.redirect(DISCORD_SIGNIN_LINK);
});
@tcaer
tcaer / .env
Last active April 14, 2020 04:06
DISCORD_CLIENT_ID=<Your Discord Client ID>
DISCORD_CLIENT_SECRET=<Your Discord Client Secret>
DISCORD_SIGNIN_LINK=<Your Discord signin link>
DISCORD_CALLBACK_URI=<Your Discord Callback URL>
require('dotenv').config();
const express = require('express');
const btoa = require('btoa');
const fetch = require('node-fetch');
app.get('/', function(req, res) {
res.send('Head to `/login` to login');
});
app.listen(3000, function() {
@tcaer
tcaer / init.vim
Last active December 25, 2019 19:22
My neovim config
set number
set updatetime=100
call plug#begin('~/.config/nvim/autoloada')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugin' }
Plug 'cloudhead/neovim-fuzzy'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
call plug#end()