Skip to content

Instantly share code, notes, and snippets.

View stravant's full-sized avatar

Mark Langen stravant

  • Beamdog
  • Edmonton AB, Canada
View GitHub Profile
@stravant
stravant / Indent.tmPreferences
Created August 11, 2012 06:12
Roblox Lua completion support for SublimeText
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Indent</string>
<key>scope</key>
<string>source.lua</string>
<key>settings</key>
<dict>
@stravant
stravant / main.cpp
Created September 18, 2012 16:24
Ardiuno Encrypt
delay(100);
randomSeed(micros());
int generator = 0;
int primmod = 0;
int priv_key = random(1000,10000);
void setup() {
@stravant
stravant / main.cpp
Created September 20, 2012 16:00
Ardiuno Comm
//maps pin => interrput number
const int INTMAP[] = {-1, -1, 0, 1, -1, -1};
const int COM_SendPin = 2;
const int COM_RecPin = 3;
const int COM_Timing = 6;
const int COM_HalfTiming = 3;
void COM_send(uint8_t b) {
@stravant
stravant / tetris.cpp
Created October 11, 2012 16:48
Arduino Tetris
#define cs 6
#define dc 7
#define rst 8 // you can also connect this to the Arduino reset
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
@stravant
stravant / terrain.lua
Created October 22, 2012 05:18
Roblox Terrain Generator
local Terrain = game.Workspace.Terrain
--==========================================================================================================--
-- Persistent noise generation code ==--
--==========================================================================================================--
--
-- Generating perlin noise is the most expensive part of the terrain generation. It is also however, totally
-- predictable, so we can pre-generate most of the perlin noise that we will need before the main terrain
@stravant
stravant / mapping.cpp
Created October 30, 2012 16:46
Mapping
/* Simple Image Drawing
*
* Draws an image to the screen. The image is stored in "parrot.lcd" on
* the SD card. The image file contains only raw pixel byte-pairs.
*/
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <SD.h>
@stravant
stravant / draw.h
Created November 5, 2012 00:03
Large map draw function
// x, y, w, h specify what region of the screen to update.
// mZoom specifies the zoom level to draw the map at (1 = 1:1, 2 = only every other pixel is shown, etc)
// mOriginX/Y specifies what position on the map is currently at the screen's top right corner.
void draw(int32_t x, int32_t y, int32_t w, int32_t h) {
tft.setAddrWindow(x, y, x+w-1, y+h-1);
//
x *= mZoom;
y *= mZoom;
x += mOriginX;
@stravant
stravant / restaurant.h
Created November 6, 2012 03:56
Packed Restaurant
class PackedRestaurantRecord {
public:
//MAD BIT TWIDDLING ~~~ AVERT YOUR GAZE!
uint8_t getBlockNum() {
return (C & 0x0F) | (D & 0xF0);
}
void setBlockNum(uint8_t n) {
C = (C & 0xF0) | (n & 0x0F);
D = (D & 0x0F) | (n & 0xF0);
}
@stravant
stravant / logic.cpp
Created November 27, 2012 17:47
Arduino Solitaire Logic
struct Card {
CardColor Color;
CardSuit Suit;
CardValue Value;
//
bool FaceUp;
//
Card* Next;
Card* Prev;
@stravant
stravant / logic.cpp
Created November 27, 2012 17:47
Arduino Solitaire Logic
struct Card {
CardColor Color;
CardSuit Suit;
CardValue Value;
//
bool FaceUp;
//
Card* Next;
Card* Prev;