Skip to content

Instantly share code, notes, and snippets.


Hassan Hayat TheSeamau5

  • Entrepreneur
  • Austin, TX
View GitHub Profile
TheSeamau5 / ECSExampleInES6.js
Last active September 16, 2022 21:41
ECS Example in Javascript / ES6
View ECSExampleInES6.js
const has = (entity, components) => {
const exists = (x) => typeof x !== "undefined";
return => exists(entity[component]))
.reduce((x,y) => x && y);
const clone = (object) => {
if (object === null || typeof object !== 'object'){
return object;
TheSeamau5 / hoveringGridExample.elm
Created March 6, 2015 01:49
Example of hovering over a grid
View hoveringGridExample.elm
import Graphics.Collage (..)
import Graphics.Element (..)
import Graphics.Input (..)
import Color (..)
import Signal (..)
import Text
import List
import Mouse
TheSeamau5 / multipageform.elm
Last active October 30, 2020 16:54
Simple multi-page form
View multipageform.elm
import Html exposing (Html, Attribute)
import Html.Attributes
import Html.Events
import Signal exposing (Address)
import List
import String
import StartApp
TheSeamau5 /
Created December 29, 2014 23:16
An exploration of the Entity Component System in Elm

#Exploring Entity Component Systems in Elm

Entity-Component-System (or ECS) is a pattern for designing programs that is prevalent in the games industry. This pattern consists of three simple parts:

  • Entity : A uniquely identifiable object that may contain any number of components
  • Component : A property usually representing the raw data of one aspect of the object. (Position is a component, Velocity is a component, Strength is a component, etc...)
  • System : A continuous process performing actions on every entity that possesses a component of the same aspect as that system

To understand this, let us try to make a simple example: Boxes that move in space:

TheSeamau5 / Maybe.cpp
Last active May 24, 2020 20:16
Maybe in C++
View Maybe.cpp
#include <string>
#include <functional>
using namespace std;
template <typename T>
struct Maybe{
T just;
bool isNothing;
TheSeamau5 / svgdragdrop.elm
Last active January 29, 2020 05:26
Drag and drop example with svg in Elm
View svgdragdrop.elm
import Svg (Svg, circle, svg, g, line, text)
import Svg.Attributes (cx, cy, r, fill, stroke, strokeWidth, x, y, x1, x2, y1, y2, fontSize, style)
import Html
import Html.Attributes as Html
import Signal (Signal, map, foldp)
import DragAndDrop (mouseEvents, MouseEvent(..))
import List
TheSeamau5 / eval_with_params.jl
Last active November 6, 2019 11:01
Evaluate a function with given parameters
View eval_with_params.jl
macro eval_with_params(expr, params...)
# Put the params before the expression
expr_with_params = [collect(params)..., expr]
# Wrap the expressions in :block Expressions
Expr(:block, expr_with_params...)
x + y,
TheSeamau5 / HackerNewsExample.elm
Last active September 23, 2018 00:24
Hacker news requests example
View HackerNewsExample.elm
import Task exposing (Task, ThreadID, andThen, sequence, succeed, spawn)
import Json.Decode exposing (Decoder, list, int, string, (:=), map, object2)
import Signal exposing (Signal, Mailbox, mailbox, send)
import List
TheSeamau5 / IdealizedECS
Last active January 27, 2018 10:31
Idealized vision of using Entity Component Systems
View IdealizedECS
Entity : Object
Component : Object
DeltaTime : Component
deltaTime : Number
TheSeamau5 / ReactNativeExample.jsx
Created March 26, 2015 21:56
React Native Example Reddit Client
View ReactNativeExample.jsx
* Sample React Native App
'use strict';
var React = require("react-native");
var {