Skip to content

Instantly share code, notes, and snippets.

View appellation's full-sized avatar

Will Nelson appellation

View GitHub Profile
@appellation
appellation / openapi.yaml
Last active February 1, 2026 17:55
Valid congress.gov OpenAPI spec
openapi: 3.0.3
info:
description: >
Congress.gov shares its application programming interface (API) with the
public to ingest the Congressional data. <a href="sign-up/"
target="_blank">Sign up for an API key</a> from api.data.gov that you can
use to access web services provided by Congress.gov. To learn more, view our
<a href="https://github.com/LibraryOfCongress/api.congress.gov/"
target="_blank">GitHub repository</a>.
title: Congress.gov API
export function add(a, b) {
return a + b + 2;
}
export function p() {
return Promise.resolve('foo');
}
let foo = "bar";
export foo;
export default function foo() {
sdk.bar();
}
@appellation
appellation / index.tsx
Created July 22, 2019 17:26
Basic React SSR
import React from 'react';
import { hydrate } from 'react-dom';
import { BrowserRouter as Router } from 'react-router-dom';
import App from './App';
hydrate(<Router><App /></Router>, document.getElementById('app'));
package state
import (
"crypto/rand"
"encoding/base64"
"encoding/binary"
"time"
)
const (
const { randomBytes } = require('crypto');
const fetch = require('node-fetch');
const FormData = require('form-data');
const { parse } = require('url');
module.exports = class OAuth2 {
constructor({
endpoint,
clientID,
clientSecret,
axios.interceptors.request.use((req) => {
let { token, secret } = req;
if (token) delete req.token;
else token = process.env.TW_TOKEN;
if (secret) delete req.secret;
else secret = process.env.TW_TOKEN_SECRET;
const oauth = {
oauth_consumer_key: process.env.TW_KEY,
oauth_nonce: crypto.randomBytes(20).toString('hex'),
@appellation
appellation / Client.js
Last active May 2, 2018 07:51
basic redis points system
const { Client } = require('discord.js');
const Redis = require('ioredis');
module.exports = new class extends Client {
constructor() {
super({
// discord.js options
});
this.redis = new Redis({
const gulp = require('gulp');
const del = require('del');
const ts = require('gulp-typescript');
const sourcemaps = require('gulp-sourcemaps');
const typedoc = require('gulp-typedoc');
const project = ts.createProject('tsconfig.json');
gulp.task('default', ['build']);
gulp.task('build', () => {