Skip to content

Instantly share code, notes, and snippets.

# Coreytiltedlistener

• Sort options
Last active May 14, 2017
JavaScript A* with Manhattan Distance
View gist:dbb267f88dacc247e5df5d0718de345e
 // A* // Much thanks to http://www.geeksforgeeks.org/a-search-algorithm/ // Extending array Array.prototype.empty = function() { return this.length == 0; }; // Constants var SQUARE_SIZE = 100;
Created Dec 7, 2016
Parse math strings and solve
View equation.js
 var equation = "1+(3+(3-2))*5/2"; var process = function(arr) { if (arr.length == 1) { return parseFloat(arr[0]); } var number = arr[0]; var operator = arr[1];
Created Oct 7, 2015
NU: Hangman Partway Wrong
View .java
 public class Hangman { private String wordToGuess = "t"; private boolean gameRunning = true; private int guessCount = 4; public void playGame() { while (gameRunning) {
Last active Oct 7, 2015
NU: Hangman Partway
View .java
 public class Hangman { private String wordToGuess = "t"; private boolean gameRunning = true; private int guessCount = 4; public void playGame() { while (gameRunning) {
Created Oct 7, 2015
Prep code for Hangman
View gist:f272434825c0cc8ab5a4
 /** * Prep Code */ // PICK A WORD // LOOP // LET THE PLAYER GUESS // IF GUESS == TRUE // CHECK IF WORD IS COMPLETE // YOU WIN
Created Apr 2, 2015
Scrolling Background in Java
View gist:8dc4258a1360d3002b12
 public void drawBackground() { // CIRCLE is a static var defined as MATH.PI * 2 // graphics() returns a Graphics2D context in this case from a BufferedImage createGraphics() method rotationOfBackground += 0.05; if(rotationOfBackground >= CIRCLE) { rotationOfBackground -= CIRCLE; } // In this case we're assuming that 300 is the height that we need int width = (int)(background.getWidth(this));
Created Feb 8, 2015
where() function for jQuery
View gist:795ea00e24210177f443
 (function ( \$ ) { \$.fn.where = function(status) { var len = this.size(); for(var i=0; i < len; i++) { if (\$(this[i]).is(status)) { return \$(this[i]); } } return [];
Last active Aug 29, 2015
Possible Drupal index.php that clears caches on each request
View gist:5a0ba5a285f5719f339e
 define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); menu_execute_active_handler(); drupal_flush_all_caches(); /** * The intent is to clear the caches so that when multiple people are sharing the same db in dev, * CSS / Template caching collisions don't occur.
Created Nov 18, 2014
Sample MySQL dump on command line
View gist:4a6df7c96ca65677159b
 mysqldump -h localhost -p -u root cookbook > cookbook.sql
Last active Aug 29, 2015
Remove all docker containers
View gist:d7b6f4b442aa3bb71a6f
 docker rm \$(docker ps -a -q) # From https://coderwall.com/p/ewk0mq
You can’t perform that action at this time.