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
//******************************************************************* | |
// Java compiler created in PHP to quickly and safely test code. | |
// NOTE: please read the 'More Info' tab to the right for shortcuts. | |
//******************************************************************* | |
import java.lang.Math; // header stuff MUST go above the first class | |
import java.util.Random; | |
import java.util.ArrayList; | |
import java.util.Arrays; |
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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.Random; | |
public class Roads { | |
public static final int TILE_SIZE = 32; | |
public static final int ROOM_HEIGHT = 1024+512; | |
public static final int ROOM_WIDTH = 1024+512; |
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
import java.awt.Point; | |
import java.awt.event.KeyEvent; | |
import java.text.DecimalFormat; | |
import java.text.NumberFormat; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.Random; | |
import java.util.Stack; |
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
import java.text.DecimalFormat; | |
import java.text.NumberFormat; | |
import java.util.AbstractCollection; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.Map; | |
import java.util.Queue; | |
import java.util.Random; | |
import java.util.Timer; | |
import java.util.TimerTask; |
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
#!/bin/sh | |
function parse_git_branch_name { | |
git rev-parse --abbrev-ref HEAD | |
} | |
function parse_git_description { | |
git config branch.$(parse_git_branch_name).description | |
} |
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
/** | |
two var sort | |
by Patrick Michaelsen | |
[email protected] | |
[email protected] | |
[email protected] | |
A fun little code I made to see if I could sort an array with just two variables. |
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
//************************************************************************// | |
// one_var_bubble_sort.c // | |
//************************************************************************// | |
// | |
// AUTHOR: Patrick Michaelsen | |
// EMAIL: [email protected] | |
// [email protected] | |
// WEBSITE: PatrickMichaelsen.com | |
// | |
// DESCRIPTION: This algorithm bubble sorts an array of |
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
WHILE no swaps performed | |
FOR pair of elements | |
IF pair is out of order | |
swap pair |
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
int maxProfit(int* prices, int n) { | |
int previous_delta = 0; | |
int delta = 0; | |
int max_profit = 0; | |
for ( int i = 1 ; i < n ; i ++ ) | |
{ | |
previous_delta = delta; | |
delta = prices[ i ] - prices [ i - 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
def maxProfit ( self, prices ): | |
previous_delta = 0 | |
delta = 0 | |
max_profit = 0 | |
for i in range( 1 , len ( prices ) ) : | |
previous_delta = delta | |
delta = prices[ i ] - prices [ i - 1 ] |
OlderNewer