Skip to content

Instantly share code, notes, and snippets.

View ericstumper's full-sized avatar

Eric ericstumper

View GitHub Profile
@ericstumper
ericstumper / index.html
Created January 24, 2020 14:00
Fixed header example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<style>
body {
margin: 0;
[LOAD_METER_DATA_LATEST_FRAME]: (state, action) => {
const currentPropertyId = state.data.findIndex(
x => x.id === action.payload
);
return {
...state,
data: {
...state.data,
[currentPropertyId]: {
...state.data[currentPropertyId],
@ericstumper
ericstumper / 0_reuse_code.js
Created February 6, 2017 15:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ericstumper
ericstumper / index.js
Created July 3, 2016 21:41
Navigation component handling logout
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-apollo';
import { push } from 'react-router-redux';
import { Link, IndexLink } from 'react-router';
import * as authActionCreators from 'actions/auth';
import { deleteToken } from 'mutations/auth';
import styles from './styles.css';
@ericstumper
ericstumper / state.json
Created July 3, 2016 09:09
State after one user logging in, logging out directly after and another user logging in afterwards
This file has been truncated, but you can view the full file.
{
"monitorState": {},
"actionsById": {
"0": {
"type": "PERFORM_ACTION",
"action": {
"type": "@@INIT"
},
"timestamp": 1467536860691,
"duration": 0.4049999999999727
@ericstumper
ericstumper / context.ex
Created June 10, 2016 11:18
Guardian Authentication with Absinthe GraphQL in Elixir
defmodule Languafy.Web.Context do
@behaviour Plug
import Plug.Conn
alias Languafy.User
def init(opts), do: opts
def call(conn, _) do
case build_context(conn) do
{:ok, context} ->
@ericstumper
ericstumper / schema.ex
Created June 9, 2016 10:04
JWT Token creation with Absinthe and Guardian
defmodule Languafy.Schema do
use Absinthe.Schema
import_types Languafy.Schema.Types
query do
@desc "Get an App User"
field :user, type: :user do
arg :id, non_null(:id)
resolve &Languafy.Resolver.User.find/2
end
defmodule Languafy.Router do
use Languafy.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end