Skip to content

Instantly share code, notes, and snippets.

View klosowsk's full-sized avatar

Rodrigo Klosowski klosowsk

View GitHub Profile
# CartPole-v0
# A pole is attached by an un-actuated joint to a cart,
# which moves along a frictionless track. The system
# is controlled by applying a force of +1 or -1 to the
# cart. The pendulum starts upright, and the goal is to
# prevent it from falling over. A reward of +1 is provided
# for every timestep that the pole remains upright.
# The episode ends when the pole is more than 15 degrees
# from vertical, or the cart moves more than 2.4 units from
@klosowsk
klosowsk / LoginContext.js
Last active May 20, 2019 18:14
Login Reducer, Context and Provider
import React, { createContext, useReducer } from 'react';
import * as types from 'constants/actionTypes';
const LoginContext = createContext();
const initialState = {
isLoggedIn: false,
token: null,
loading: false,
error: null,
import React, { useContext } from 'react';
import { LoginContext } from "contexts/LoginContext";
...
const signIn = async values => {
const loginContext = useContext(LoginContext);
try {
const { email, password } = values;
loginContext.actions.loginLoading();
import React from 'react';
import { LoginContextProvider } from 'contexts';
const App = () => {
return (
<LoginContextProvider>
{/* Your Application Content Goes in here */}
</LoginContextProvider>
);
};
import { Avalanche, BinTools, Buffer, BN } from "avalanche";
import {
AVMAPI,
KeyChain as AVMKeyChain,
UTXOSet,
UnsignedTx,
Tx,
MinterSet,
AVMConstants,
UTXO,