Skip to content

Instantly share code, notes, and snippets.

kittykatattack

  • Toronto
Block or report user

Report or block kittykatattack

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 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
@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
}
@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;
@kittykatattack
kittykatattack / movingCircleCollision
Created Aug 27, 2014
A function that bounces apart two moving circles
View movingCircleCollision
/*
# movingCircleCollision
Use it to make two moving circles bounce off each other.
Parameters:
a. A sprite object with `x`, `y` `centerX`, `centerY` and `radius` properties.
b. A sprite object with `x`, `y` `centerX`, `centerY` and `radius` properties.
The sprites can contain an optional mass property that should be greater than 1.
*/
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.
You can’t perform that action at this time.