Skip to content

Instantly share code, notes, and snippets.

View larkintuckerllc's full-sized avatar

John Tucker larkintuckerllc

View GitHub Profile
@larkintuckerllc
larkintuckerllc / Decrement.jsx
Created June 3, 2018 01:37
GraphQL and Apollo Client by Example: Part 3 - 3
import gql from 'graphql-tag';
import { PropTypes } from 'prop-types';
import React from 'react';
import { Mutation } from 'react-apollo';
const DecrementView = ({ onDecrement }) => (
<button onClick={onDecrement}>-</button>
);
DecrementView.propTypes = {
@larkintuckerllc
larkintuckerllc / defaults.js
Created June 3, 2018 21:48
GraphQL and Apollo Client by Example: Part 4 - 1
export default {
counter: 0,
todos: [],
};
@larkintuckerllc
larkintuckerllc / typeDefs.js
Created June 3, 2018 21:50
GraphQL and Apollo Client by Example: Part 4 - 2
export default `
type Todo {
id: Int!
text: String!
completed: Boolean!
}
type Query {
counter: Int
todos: [Todo]
@larkintuckerllc
larkintuckerllc / resolvers.js
Created June 3, 2018 21:51
GraphQL and Apollo Client by Example: Part 4 - 3
import gql from 'graphql-tag';
const query = gql`
{
counter @client
}
`;
let nextTodoId = 0;
@larkintuckerllc
larkintuckerllc / Todo.jsx
Created June 4, 2018 08:55
GraphQL and Apollo Client by Example: Part 4 - 4
...
const Todo = ({ completed, id, text }) => (
<Mutation mutation={TOGGLE_TODO} variables={{ id }}>
{toggleTodo => (
<TodoView
completed={completed}
text={text}
onClick={toggleTodo}
/>
)}
@larkintuckerllc
larkintuckerllc / Cube.cs
Last active June 27, 2018 23:01
Magic Leap (Unity on a Mac) by Example: Part 1 - 1
using UnityEngine;
using UnityEngine.Experimental.XR.MagicLeap;
public class Cube : MonoBehaviour
{
private static int BUTTON_ACTIVE = 1;
private static int BUTTON_INACTIVE = 0;
private static Color BUTTON_ACTIVE_COLOR = Color.blue;
private static Color BUTTON_INACTIVE_COLOR = Color.white;
@larkintuckerllc
larkintuckerllc / Gesture.cs
Last active June 28, 2018 18:51
Magic Leap (Unity on a Mac) by Example: Part 2 - 1
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Experimental.XR.MagicLeap;
public class Gesture : MonoBehaviour
{
private static float GESTURE_CONFIDENCE_THRESHOLD = 0.5f;
private static Color COLOR_BOTH = Color.magenta;
private static Color COLOR_LEFT = Color.red;
@larkintuckerllc
larkintuckerllc / Planes.cs
Created June 30, 2018 09:35
Magic Leap (Unity on a Mac) by Example: Part 3 - 1
using UnityEngine;
using UnityEngine.Experimental.XR.MagicLeap;
public class Planes : MonoBehaviour {
private static uint MAX_RESULTS = 100;
public Transform BBoxTransform;
public Vector3 BBoxExtents;
public GameObject prefab;
@larkintuckerllc
larkintuckerllc / Raycast.cs
Created July 1, 2018 07:43
Magic Leap (Unity on a Mac) by Example: Part 4 - 1
using UnityEngine;
using UnityEngine.Experimental.XR.MagicLeap;
public class Raycast : MonoBehaviour {
static Vector3 POSITION = new Vector3(0.0f, 0.5f, 0.0f);
static Vector3 DIRECTION = new Vector3(-1.0f, 0.0f, 0.0f);
public GameObject prefab;
@larkintuckerllc
larkintuckerllc / Ball.cs
Last active July 4, 2018 12:17
Magic Leap (Unity on a Mac) by Example: Part 5 - 1
using System;
using UnityEngine;
using UnityEngine.Experimental.XR.MagicLeap;
public class Ball : MonoBehaviour {
// HANDS
static MLHandKeyPose H_KEYPOSE = MLHandKeyPose.Fist;
static float H_KEYPOSE_CONFIDENCE_THRESHOLD = 0.5f;