Skip to content

Instantly share code, notes, and snippets.

David Pennington Xeoncross

Block or report user

Report or block Xeoncross

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
laughinghan / Every possible TypeScript
Last active Jan 17, 2020
Diagram of every possible TypeScript type
View Every possible TypeScript

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything at all is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
    • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
View AuthPortal.tsx
import axios from 'axios'
import AsyncStorage from '@react-native-community/async-storage'
import React, { useEffect, useState } from 'react'
import { Linking } from 'react-native'
import InAppBrowser from 'react-native-inappbrowser-reborn'
import { LoadingIndicator } from '../LoadingIndicator'
interface AuthPortalProps {
client_id: string
scopes: string[]
enepomnyaschih / base64.js
Last active Jan 8, 2020
Encode JS Uint8Array, simple array of bytes or native JS string to base64
View base64.js
const base64abc = (() => {
let abc = [],
A = "A".charCodeAt(0),
a = "a".charCodeAt(0),
n = "0".charCodeAt(0);
for (let i = 0; i < 26; ++i) {
abc.push(String.fromCharCode(A + i));
for (let i = 0; i < 26; ++i) {
abc.push(String.fromCharCode(a + i));
View ApiProvider.tsx
import * as React from 'react';
import Axios, { AxiosInstance } from 'axios';
import { createContext, consume } from '../lib/context-utils';
import { AuthContext } from './AuthProvider';
export const ApiContext = createContext('apiContext', {
api: undefined as AxiosInstance | undefined,
auth: undefined as React.ContextType<typeof AuthContext> | undefined,
View user.js
import React from 'react';
import { Auth } from 'aws-amplify';
// Create a context that will hold the values that we are going to expose to our components.
// Don't worry about the `null` value. It's gonna be *instantly* overriden by the component below
export const UserContext = React.createContext(null);
// Create a "controller" component that will calculate all the data that we need to give to our
// components bellow via the `UserContext.Provider` component. This is where the Amplify will be
// mapped to a different interface, the one that we are going to expose to the rest of the app.
EduVencovsky / Auth.jsx
Last active Dec 24, 2019
Private Routes with Auth using react-router and Context API
View Auth.jsx
import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { checkIsAuthenticated, authSignUp, authLogin, authLogout } from '../../services/auth'
export const AuthContext = React.createContext({})
export default function Auth({ children }) {
const [isAuthenticated, setIsAuthenticated] = useState(false)
const [isLoading, setIsLoading] = useState(true)
View goeventbus-final.go
package main
import (
type DataEvent struct {
kvnxiao /
Last active Jan 21, 2020

Awesome Go

Build Status Awesome Slack Widget Netlify Status

patreon avelino financial support to Awesome Go

A curated list of awesome Go frameworks, libraries and software. Inspired by awesome-python.


EnchanterIO / bitcoin_pow_nonce_hashing.go
Last active Feb 11, 2019
Implementing Bitcoin's Proof of Work hashing mechanics based on a concept of Nonce using GoLang. This exercise is part of BlocksByLukas twitter-chain series on blockchain:
View bitcoin_pow_nonce_hashing.go
package main
// Author:
// PoW Theory:
// Description: Implementing Bitcoin's Proof of Work hashing mechanics based on a concept of Nonce using GoLang.
// The demonstration is not super efficient but easily readable for demonstration purposes.
import (
yoya3312 /
Created Jan 10, 2019
streamlink with youtube
import re
from streamlink.compat import urlparse, parse_qsl
from streamlink.plugin import Plugin, PluginError
from streamlink.plugin.api import http, validate
from streamlink.plugin.api.utils import parse_query
from import HTTPStream, HLSStream
from import MuxedStream
import json
You can’t perform that action at this time.