Skip to content

Instantly share code, notes, and snippets.

Avatar

kittykatattack

  • UK
View GitHub Profile
@kittykatattack
kittykatattack / Main.elm
Created Jun 12, 2016
Basic Elm 0.17 Beginner Program starter template
View Main.elm
import Html exposing (..)
import Html.App as Html
-- MODEL
type alias Model =
{ value : Int
}
View gist:bfc18cef6ad9f91437fbe268c69f3901
import Html exposing (..)
import Html.App as Html
import Html.Events exposing (..)
-- MODEL
type alias Model =
{ content : String
}
View ButtonUtilities.elm
module ButtonUtilities exposing (..)
import Html exposing (Html, div, text, button, p)
import Html.Events exposing (onClick)
-- Create an ID type that will but used to tag each
-- button in the model's `buttons` array with a unique id
View chatBot.elm
module Main exposing(..)
import Html exposing (..)
import Html.App as Html
import Html.Events exposing (..)
import Html.Attributes exposing (src, style, class, id, width, height, autoplay, loop)
import Json.Decode as Json
import String
import String.Extra
import List.Extra
View addStatePlayer
/*
An advanced frame and state manager for Pixi MovieClip sprites.
Use it like this:
Add the advanced state player to a PIXI.MovieClip
addStatePlayer(movieClipSprite);
Set the frame rate
View gist:f05b42efc6ecf09ddf244bbafd18edb3
port module Main exposing(..)
import Html exposing (..)
import Html.App as Html
import Html.Events exposing (..)
import Html.Attributes exposing (src, style)
import Json.Decode as Json
import String
import String.Extra
import Regex
@kittykatattack
kittykatattack / flatCounterPair.elm
Last active Aug 22, 2016
Flat Elm UI Component Architecture Experiment
View flatCounterPair.elm
import Html exposing (Html, button, div, text)
import Html.App as Html
import Html.Events exposing (onClick)
main =
Html.beginnerProgram
{ model = model
, view = view
View gist:e3e2505a50686bbdeef9
/*
makeIsoTiledWorld
=================
An interpreter for isometric Tiled Editor JSON output.
Important: To work it requires to custom map properties:
`cartTilewidth` and `cartTileheight`. These are the Cartesian
(flat 2D) dimensions of the tile map array. These are needed
because it's common to have a 32x32 tile map array that displays
64x64 sprites.
@kittykatattack
kittykatattack / rectangleCollision
Created Nov 12, 2014
A collision function two prevent two rectangular sprites from overlapping. Optionally, bounce them apart
View rectangleCollision
/*
#### rectangleCollision
Use it to prevent two rectangular sprites from overlapping.
Optionally, make the first retangle bounceoff the second rectangle.
Parameters:
a. A sprite object with `x`, `y` `center.x`, `center.y`, `halfWidth` and `halfHeight` properties.
b. A sprite object with `x`, `y` `center.x`, `center.y`, `halfWidth` and `halfHeight` properties.
c. Optional: true or false to indicate whether or not the first sprite
should bounce off the second sprite.
@kittykatattack
kittykatattack / webAudioWrapper
Last active Aug 29, 2015
Load and play sounds easily. A lightweight high level wrapper for WebAudio API.
View webAudioWrapper
<!doctype html>
<meta charset="utf-8">
<title>Basic WebAudio API sound sprite</title>
<p>Press 1 to play the sound</p>
<script>
//Define the audio context
window.AudioContext = window.AudioContext || window.webkitAudioContext;
You can’t perform that action at this time.