Skip to content

Instantly share code, notes, and snippets.

View RichardBray's full-sized avatar
😎
Fix bug , drink milkshake, code feature, repeat.

Richard Oliver Bray RichardBray

😎
Fix bug , drink milkshake, code feature, repeat.
View GitHub Profile
@RichardBray
RichardBray / shader.frag
Last active September 17, 2020 09:41
Simple fragment shader for beginners with explanations
// # = Preprocessor macros
#ifdef GL_ES // OpenGL Embedded systems needed for openGL on web and mobile devices
precision mediump float; // level of precision for float https://stackoverflow.com/questions/13780609/what-does-precision-mediump-float-mean
// Lower precision means faster compilation but lower quality, above sets all floats to medium precision
#endif
void main() // Main entry point function like c/c++
{
// gl_FragColor = built in global variable to determine pixel color
// werid because you don't see it imported or extended it just exists
@RichardBray
RichardBray / FlxFSM-example.hx
Last active September 1, 2020 09:01
An example file on how to use FlxFSM. A bit simpler than the example from the demo on the HaxeFlixel site.
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.addons.util.FlxFSM;
/**
* Example of how to use the FlxFSM addon.
* For more informtaion on this file check this youtube video.
*
* @see Video-TBA
import { Provider } from "react-redux";
import configureStore from "redux-mock-store";
// ...
describe('App', () => {
// ...
describe('Question', () => {
// - setup redux store
import * as Store from "./AppContext";
// ...
describe('App', () => {
// ...
describe('Question', () => {
// - context spy
const contextValues = { chosenAnswers: [], setChosenAnswers: () => {} };
// AppContext.js
import { createContext, useContext } from "react";
export const Store = createContext();
export const useAppContext = () => useContext(Store);
// App.jsx
import React, { Fragment } from "react";
// Context
import { Store, useAppContext } from "./AppContext";
// - Data
import data from "./data.json";
export default function App() {
// ...
describe("App", () => {
const wrapper = mount(<App />);
// ...
test("Contains a Start and a Finish page", () => {
// - when
const startComp = wrapper.find("Start");
// App.jsx
import React, { Fragment } from "react";
// - Data
import data from "./data.json";
export default function App() {
function renderQuestions() {
return data.results.map((result, index) => (
// App.test.js
import React from "react";
import Enzyme, { mount } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import data from "./data.json";
import App from "./App";
Enzyme.configure({ adapter: new Adapter() });
@RichardBray
RichardBray / test1.jsx
Last active April 3, 2020 15:52
Enzyme test doc 1 test
// App.jsx
import React, { Fragment } from "react";
// - Data
import data from "./data.json";
export default function App() {
function renderQuestions() {
return data.results.map((result, index) => (