Skip to content

Instantly share code, notes, and snippets.

View RichardMarks's full-sized avatar

Richard Marks RichardMarks

View GitHub Profile
@RichardMarks
RichardMarks / cbpy.py
Last active August 29, 2015 14:02
codingbat-python-solutions
# Warmup-1
def sleep_in(weekday, vacation):
if weekday and not vacation:
return False
return True
def monkey_trouble(a_smile, b_smile):
if a_smile and not b_smile or not a_smile and b_smile:
return False
return True
@RichardMarks
RichardMarks / Reflection.cpp
Created June 9, 2014 20:37
C++ Reflection System by Mattias Gustavsson - Used with Permission.
//*** Reflection.cpp ***
#include "Reflection.h"
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <string.h>
@RichardMarks
RichardMarks / patch
Created September 1, 2014 10:34
fix Quintus (latest tag 0.1.5) to pass jshint errors
commit e5a93132107d83b207209f76fc116f45973a7d87
Author: Richard Marks <ccpsceo@gmail.com>
Date: Mon Sep 1 05:27:49 2014 -0500
fixed code to pass jshint checks
diff --git a/lib/quintus.js b/lib/quintus.js
index fda2556..2567152 100644
--- a/lib/quintus.js
+++ b/lib/quintus.js
@RichardMarks
RichardMarks / MyGdxGame.java
Created February 23, 2015 05:23
using universal tween engine and libgdx
package com.mygdx.game;
import aurelienribon.tweenengine.*;
import aurelienribon.tweenengine.equations.Bounce;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@RichardMarks
RichardMarks / gist:767590
Created January 6, 2011 06:02 — forked from jakevsrobots/gist:460662
Python script for compiling OGMO tile layers into CSV
#!/usr/bin/python
import os, sys
from xml.dom import minidom
#--------------------------------------
BASE_PATH = os.path.dirname(__file__)
MAP_SRC_DIR = os.path.join(BASE_PATH, 'data/maps')
MAP_COMPILED_DIR = os.path.join(BASE_PATH, 'data/maps/compiled')
@RichardMarks
RichardMarks / FPDemo.as
Created January 7, 2011 01:13
FlashPunk and AIR - How to obtain the Window Dimensions
package
{
import flash.desktop.NativeApplication;
import flash.events.Event;
import flash.events.NativeWindowBoundsEvent;
import net.flashpunk.Engine;
import net.flashpunk.FP;
import net.flashpunk.Screen;
/**
* ...
@RichardMarks
RichardMarks / Screen.as
Created January 8, 2011 04:04
Allow resizing of screen. Patch for FlashPunk Screen.as -- This is NOT the entire Screen.as, just a patch
// Screen.as PATCH Richard Marks <ccpsceo@gmail.com> - Jan 07, 2011
/**
* resizes the screen - updates FP dimension variables
* you should not do this a lot, there will be lag.
* @param width new width of the screen
* @param height new height of the screen
*/
public function resize(width:uint, height:uint):void
{
// tell FP the screen size has changed
@RichardMarks
RichardMarks / hello.ecpua
Created January 12, 2011 12:50
Hello World in ECPU Assembly
; hello.ecpua
inc 0x0A
print ; newline
inc 0x3E
print ; H
inc 0x1D
print ; e
inc 0x07
print ; l
print ; l
@RichardMarks
RichardMarks / MapEntity.as
Created January 15, 2011 12:30
changes for warpin project
// Add to MapEntity.as - this is not the full MapEntity.as file.
/**
* checks if there is a warp that collides with the specified entity
* @param e - the entity to test collision against
* @return null if no warp is found, and the WarpPoint object if there is one
*/
public function CheckWarpCollidesWith(e:Entity):WarpPoint
{
// loop through each warp in the warps container
// sprites.png is 640x240 with the left 320x240 holding player sprite frames
// and the right 320x240 holding the enemy frames
[Embed(source="../assets/sprites.png")] private const SPRITES_PNG:Class;
var sprites:BitmapData = (new SPRITES_PNG).bitmapData;
var playerSprites:BitmapData = new BitmapData(320, 240);
var enemySprites:BitmapData = new BitmapData(320, 240);
playerSprites.copyPixels(sprites, new Rectangle(0,0, 320, 240), new Point);