Skip to content

Instantly share code, notes, and snippets.

View cangevine's full-sized avatar

Colin Angevine cangevine

View GitHub Profile
<html>
<head>
<script type="text/javascript">
var plainTexts = document.getElementById("input");
plainText = plainTexts.value;
var alpha= "abcdefghijklmnopqrstuvwxyz";
var key= 2 ;
// plaintext.charAt (0) then keep going until you reach the length of the phrase//
function ceaserCypher() {
<!DOCTYPE html>
<html>
<head>
<title>Caesar Cipher</title>
<script>
function cipher() {
var alphabet = "abcdefghijklmnopqrstuvwxyz";
var secretMessage = "alec";
var key = 3;
for(i = 0; i < secretMessage.length; i++){
<!DOCTYPE html>
<html>
<head>
<script>
var message= prompt("type your message son");
var key = 2 ;
var alpha= "abcdefghijklmnopqrstuvwxyz" ;
<!DOCTYPE html>
<html>
<head>
<title>Encrypt</title>
<link type="text/css" rel="stylesheet" href="ceasarcss.css" />
<script>
function encryptText(){
var key = 2;
var msg = document.getElementById('a').value;
for(i=0; i<msg.length; i++){
Stack.prototype.getLength = function() {
if (this.top == null) {
// If the Stack is empty, return 0
return 0;
} else {
// Otherwise start at the top, and begin counting at 1
var n = this.top;
var len = 1;
// Every time we call getNextNode() and get a Node object back (instead of null)...
while (n.getNextNode() != null) {
@cangevine
cangevine / gist:7931114
Created December 12, 2013 16:46
Get time and date information from PHP
<?php
// Get one aspect of the date, save it as a variable
$hour = date("H");
$minute = date("i");
$ampm = date("A");
// For more information on specifying the format with the letter codes, check here:
// http://www.php.net/manual/en/function.date.php
@cangevine
cangevine / gist:8363273
Created January 10, 2014 21:44
Stepper motor example
// Wiring configuration to the stepper driver: yellow & red, gray & green
#include <Stepper.h>
const int STEPS_PER_REV = 200;
Stepper _stepper(STEPS_PER_REV, 12, 13);
const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
public class Reverser {
public static void main(String[] args) {
String input = "1 2 3";
String output = "";
System.out.println("Input :: "+input);
while (input.length() > 0) {
String element = input.substring(input.length() - 1, input.length());
output += element;
input = input.substring(0, input.length() - 1);
public class Register {
public static void main(String[] args) {
System.out.println("Welcome to the cash register!");
double cost = 9.76;
double totalPaid = 20.00;
double change = totalPaid - cost;
int dollars = (int) Math.floor(change);
@cangevine
cangevine / gist:9106929
Last active August 29, 2015 13:56
Racer
interface Racer {
boolean crossedFinishLine();
void tick();
void setTrack(String[] t);
int getTrackLength();
int getPositionOnTrack();
int getMaxSpeed();
int getMaxHandling();
}