This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hangman { | |
private String wordToGuess = "t"; | |
private boolean gameRunning = true; | |
private int guessCount = 4; | |
public void playGame() { | |
while (gameRunning) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hangman { | |
private String wordToGuess = "t"; | |
private boolean gameRunning = true; | |
private int guessCount = 4; | |
public void playGame() { | |
while (gameRunning) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prep Code | |
*/ | |
// PICK A WORD | |
// LOOP | |
// LET THE PLAYER GUESS | |
// IF GUESS == TRUE | |
// CHECK IF WORD IS COMPLETE | |
// YOU WIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump -h localhost -p -u root cookbook > cookbook.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker rm $(docker ps -a -q) | |
# From https://coderwall.com/p/ewk0mq |
NewerOlder