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
iceX += iceSpeed; | |
if (iceX + iceWidth < 0) | |
{ | |
iceX = windowWidth + r.nextInt(500); | |
iceSpeed = 2 + r.nextInt(25); | |
iceWidth = 30 + r.nextInt(30); | |
iceHeight = 60 + r.nextInt(20); | |
} |
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
if (aX < bX + bW | |
&& bX < aX + aW | |
&& aY < bY + bH | |
&& bY < aY + aH) | |
{ | |
// A and B have collided! | |
} |
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
JFrame window = new JFrame("My Game"); | |
MyGame game = new MyGame(); | |
window.add(game); | |
window.pack(); | |
window.setLocation(100, 100); | |
window.setVisible(true); | |
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
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
g.setColor(Color.GREEN); | |
g.drawRect(50, 50, 100, 100); | |
g.fillRect(50, 50, 100, 100); | |
g.drawOval(50, 50, 100, 100); | |
g.fillOval(50, 50, 100, 100); | |
g.drawLine(50, 50, 100, 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
import com.xtremelabs.robolectric.Robolectric; | |
import com.xtremelabs.robolectric.RobolectricTestRunner; | |
public class MyTestRunner extends RobolectricTestRunner { | |
public MyTestRunner(Class<?> testClass) throws InitializationError { | |
super(testClass); | |
addClassOrPackageToInstrument("com.package.ClassToShadow"); | |
} |
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
# Download diffmerge from http://www.sourcegear.com/diffmerge/ | |
git config --global merge.tool diffmerge | |
git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE" | |
git config --global mergetool.diffmerge.trustExitCode true | |
git config --global mergetool.keepBackup false | |
git config --global diff.tool diffmerge | |
git config --global difftool.diffmerge.cmd "diffmerge \$LOCAL \$REMOTE" |
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/bash | |
# Lists the weeks between now and $1. You may specify the end date in any | |
# way that GNU date accepts, such as "Aug 25", "next year" or "2 months". | |
# | |
# If your system date is BSD date (like on Mac OS X), you will need to install | |
# GNU coreutils, ideally with http://mxcl.github.com/homebrew/ | |
# "brew install coreutils" |
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/bash | |
# imgur script by Bart Nagel <[email protected]> | |
# version 2 | |
# I release this as public domain. Do with it what you will. | |
# | |
# 2012-06-16 Aaron VonderHaar <[email protected]> | |
# - modified to work with BSD sed (don't use the -r flag) | |
# - disable the check for xsel / xclip | |
# - new API key |
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
PROJECT_NAME = "AwesomeThing" | |
APP_NAME = "AwesomeThing" | |
@configuration = "Debug" | |
@app_suffix = "-Dev" | |
@staging_developer_name = "iPhone Developer: <<FILL ME IN>>" | |
@staging_provisioning_profile = "Support/AwesomeThing.mobileprovision" | |
@production_developer_name = "iPhone Distribution" | |
@production_provisioning_profile = "Support/AwesomeThing.mobileprovision" | |
@appstore_developer_name = "iPhone Distribution" | |
@appstore_provisioning_profile = "Support/AwesomeThing.mobileprovision" |
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 CustomWidget extends JComponent { | |
private List<RenderingCommand> rendering; | |
public void draw(List<RenderingCommand> rendering) { | |
this.rendering = rendering; | |
repaint(); | |
} | |
public void paintComponent(Graphics g) { | |
for (RenderingCommand command : rendering) { |