Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Fix bug , drink milkshake, code feature, repeat.

Richard Oliver Bray RichardBray

😎
Fix bug , drink milkshake, code feature, repeat.
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am richardbray on github.
  • I am richbray (https://keybase.io/richbray) on keybase.
  • I have a public key ASCLyjIa-d-1ov2SDJYGL9OPmfg6vaAPc8igJnyf9Wrpago

To claim this, I am signing this object:

@RichardBray
RichardBray / glsl_circle.frag
Last active Oct 13, 2020
Simple GLSL circle example
View glsl_circle.frag
#ifdef GL_ES
precision mediump float;
#endif
// Being in values from the CPU
// Read only value sent to all the threads/processes
uniform vec2 u_resolution; // Global vector shader variable
float circleShape(float radius, vec2 position) {
// distance(p1, p2) - returns the distance between two points
@RichardBray
RichardBray / shader.frag
Last active Sep 17, 2020
Simple fragment shader for beginners with explanations
View shader.frag
// # = 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 Sep 1, 2020
An example file on how to use FlxFSM. A bit simpler than the example from the demo on the HaxeFlixel site.
View FlxFSM-example.hx
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
View test4-test.js
import { Provider } from "react-redux";
import configureStore from "redux-mock-store";
// ...
describe('App', () => {
// ...
describe('Question', () => {
// - setup redux store
View test3-test.js
import * as Store from "./AppContext";
// ...
describe('App', () => {
// ...
describe('Question', () => {
// - context spy
const contextValues = { chosenAnswers: [], setChosenAnswers: () => {} };
View test3-1.jsx
// AppContext.js
import { createContext, useContext } from "react";
export const Store = createContext();
export const useAppContext = () => useContext(Store);
View test3.jsx
// App.jsx
import React, { Fragment } from "react";
// Context
import { Store, useAppContext } from "./AppContext";
// - Data
import data from "./data.json";
export default function App() {
View test2-test.jsx
// ...
describe("App", () => {
const wrapper = mount(<App />);
// ...
test("Contains a Start and a Finish page", () => {
// - when
const startComp = wrapper.find("Start");
View test2.jsx
// 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) => (