Skip to content

Instantly share code, notes, and snippets.

@jdoig
jdoig / 0_reuse_code.js
Created January 11, 2017 20:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am jdoig on github.
  • I am jamesdoig (https://keybase.io/jamesdoig) on keybase.
  • I have a public key whose fingerprint is 3969 9C8A C169 BB2D 80C1 C892 4DEB 3CFD B920 BBE0

To claim this, I am signing this object:

@jdoig
jdoig / gist:37b6f1fcf9840a8949d6
Last active August 29, 2015 14:06
WIP Tamigochi (about 50-60 mins in)
import sys
import time
from datetime import datetime, timedelta
from random import randint
STATES = {
'happy': lambda a: ('happy','prrrr') if not a else (
'sad', 'pffft'),
'hungry': lambda a: ('happy', 'nom') if a == 'feed' else (
'sad', "no I'm hungry!"),
ig.module
'game.entities.Player'
.requires
'impact.entity'
.defines =>
class @.EntityPlayer extends ig.Entity
animSheet: new ig.AnimationSheet 'media/player.png', 16, 16
size:
@jdoig
jdoig / Application.coffee
Created February 25, 2013 23:03
A Mario sprite animated using game{closure} and coffeescript
`import ui.SpriteView as SpriteView;`
class Mario extends GC.Application
initUI: ->
sprite = new SpriteView({
superview: @.view
x: 100
y: 100
width: 23
height: 29
@jdoig
jdoig / Application.coffee
Last active December 13, 2015 20:38
Coffeescript game{closure} trail animation example
`import ui.View as View`
`import animate`
toColor = (x) -> (x % 255).toString(16)
class Trail extends GC.Application
createTrail: (pt) ->
opts = merge(pt, {superview: GC.app.view})
new TrailBox(pt, opts)
@jdoig
jdoig / Application.coffee
Last active December 13, 2015 19:58
hello-world for game{closure} in coffeescript
`import ui.TextView as TextView`
class helloWorld extends GC.Application
initUI:->
textView = new TextView({
superview: @view
layout: "box"
text: "Hello, Coffee!"
color: "white"})
@jdoig
jdoig / github_java_import_demo.clj
Created August 12, 2012 09:39
importing java example
(ns github-java-import-demo.core
(:import (ie.ucd.murmur MurmurHash))
(:gen-class))
(defn -main
"I don't do a whole lot."
[& args]
(println (str "Hello " (MurmurHash/hash32 "World"))))
@jdoig
jdoig / project.clj
Created August 12, 2012 09:32
adding git dependancies to a project
:git-dependencies [["git://github.com/tnm/murmurhash-java.git"]]
:java-source-paths [".lein-git-deps/murmurhash-java/src/main/java/ie/ucd/murmur/"]
@jdoig
jdoig / profiles.clj
Created August 12, 2012 09:31
example of a profile using github repro plugin
{:user {:plugins [[lein-difftest "1.3.7"]
[lein-marginalia "0.7.1"]
[lein-pprint "1.1.1"]
[lein-swank "1.4.3"]
[lein-git-deps "0.0.1-SNAPSHOT"]]}}