Skip to content

Instantly share code, notes, and snippets.

View jketcham's full-sized avatar

Jack Ketcham jketcham

View GitHub Profile
@jketcham
jketcham / gameComplete
Created April 9, 2013 02:49
Method that does the thing when the person completes the game
else if(operation == 2) {
InfoPackage pack = new InfoPackage();
String tTime = pack.getTime();
try {
getAppletContext().showDocument(new URL(getCodeBase()+"thanks.php?time=" + tTime ),"_top");
}
catch (MalformedURLException ex) {
System.out.println(ex.getMessage());
}
}
@jketcham
jketcham / operation = 0
Created April 10, 2013 04:36
Operation 0 of the running loop, looking for cause of data being sent to server twice
if(map[pX][pY] == Constants.MAP_WIN) {
endDate = new java.util.Date();
SimpleDateFormat sdf;
sdf = new SimpleDateFormat("hh:mm:ss.SSS");
eTime = sdf.format(endDate);
SendData sender = new SendData(packUp(sTime, eTime, recActions));
sendThread = new Thread(sender);
sendThread.start();
@jketcham
jketcham / reddit.html
Last active December 16, 2015 08:19 — forked from sente/reddit.html
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.9.1.min.js"><\/script>')</script>
</head>
<body>
<div id="reddit-content">
@jketcham
jketcham / drop.sublime-snippet
Created April 29, 2013 07:31
Sublime Text 2 Dropplet post snippet
<snippet>
<content><![CDATA[
# ${1:Your Post Title}
- ${2:Name}
- ${3:Twitter handle}
- ${4:2013/04/23}
- ${5:Post Category}
- ${6:Post Status (e.g. "published" or "draft")}
${7:Your post text starts here.}
@jketcham
jketcham / tab-escape
Created February 6, 2014 03:44
Sublime Text 2 - Tab to escape auto completed parenthesis, brackets, etc.
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "auto_complete_visible", "operator": "not_equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(\\]|\\)|\\}|>|\\\"|'|\\;)", "match_all": true }
]
}
@jketcham
jketcham / error2
Last active August 29, 2015 13:59
Error output from vagrant
Stderr from the command:
stdin: is not a tty
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
@jketcham
jketcham / config.yml
Created April 16, 2014 23:22
config file from puphpet
---
vagrantfile-local:
vm:
box: ubuntu-precise12042-x64-vbox43
box_url: 'http://box.puphpet.com/ubuntu-precise12042-x64-vbox43.box'
hostname: null
network:
private_network: 192.168.56.101
forwarded_port:
AErO1YHRmKKz:
@jketcham
jketcham / app.js
Last active August 29, 2015 14:02
Shake elements on hover
/**
* Animate elements on hover
*
* Requires animate.css & JQuery
*/
$('.element').hover(function() {
var element = $(this);
element.addClass('animated shake');
}, function() {
var element = $(this);
@jketcham
jketcham / gist:e8b4c88c130a2d4b2aae
Last active August 29, 2015 14:06
Mongoose Schema
var GameSchema = new Schema({
title: String,
description: String,
location: String,
created_on: { type: Date, default: Date.now },
active: { type: Boolean, default: true },
accepting_players: { type: Boolean, default: true },
players: [{
type: Schema.Types.ObjectId,
ref: 'User'
@jketcham
jketcham / matchSearchTerm
Created January 27, 2016 23:26
highlight words in a string that match a given term
function matchSearchTerm(string, matchTerm) {
if (!matchTerm) return string;
var words = string.split(' ');
var final = '';
var parsedWords = [];
words.forEach((word, index) => {
if (word.toLowerCase().indexOf(matchTerm) > -1) {
if (final) parsedWords.push(final);