Skip to content

Instantly share code, notes, and snippets.

View edprince's full-sized avatar

Ed Prince edprince

View GitHub Profile
@edprince
edprince / Enemy Costume Switch
Last active August 29, 2015 14:01
Getting enemy to switch costume and drop off screen when hit
//spr_EnemyDead is a speparate sprite that contains the image of the enemy rotated slightly.
//Trying to get enemy once hit, to switch to spr_EnemyDead and then fall off screen, at the moment, as soon
//as player bounces off head he switches back to alive sprite.
//Enemy Movement
hsp = dir * movespeed;
vsp += grav;
sprite_index = spr_enemy
//Horizontal Collision
import socket
import sys
HOST = "127.0.0.1"
PORT = 30000
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
print "Socket created"
except socket.error as msg:
@edprince
edprince / index.html
Created July 23, 2014 16:02
index.html
<html>
<head>
<title>communicate with device</title>
<style type=text/css>
.btn {
border-radius: 5px;
height: :50px;
width: 150px;
font-family: Ubuntu;
text-align: center;
@edprince
edprince / displaydata.php
Created August 20, 2014 12:43
Code for PHP web page update from MySQL database
<?php
session_start()
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"
<link href="index.html">
<link href="displaydatatest.php">
<script>
@edprince
edprince / displaydata.php
Created August 21, 2014 13:53
UDP PACKET PRESENTATION #1
<?php
#session_start();
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"
<link href="index.html">
<link href="displaydatatest.php">
@edprince
edprince / app.js
Last active August 29, 2015 14:05
Work project
function init() {
document.getElementById("Submit").addEventListener('click', ajax);
}
function ajax() {
console.log("Function started");
request = new XMLHttpRequest();
request.open('GET', 'getData.php', true);
request.onload = function() {
var assert = require('assert');
function validateEmail(email) {
var regex = /.*@.*\..*/;
if (email.match(regex) !== null) {
return true;
} else {
return false;
}
}
var assert = require('assert');
function validateEmail(email) {
var regex = /.*@.*\..*/;
return email.match(regex);
}
describe('Email Validation', function() {
describe('Types', function() {
it('should be a function', function() {
var assert = require('assert');
function validateEmail(email) {
var regex = /.*@.*\..*/;
return email.match(regex);
}
describe('Email Validation', function() {
describe('Types', function() {
it('should be a function', function() {
var form = document.getElementById('registration');
form.addEventlistener('submit', function() {
if (check()) {
return true;
} else {
return false;
}
});
function check(){