Skip to content

Instantly share code, notes, and snippets.

View matthiasbruns's full-sized avatar
💭
working on happyann-backend

Matthias Bruns matthiasbruns

💭
working on happyann-backend
View GitHub Profile
local tx = actor.x + actor.vx
local ty = actor.y + actor.vy
-- check for collision
while is_solid_a(actor, tx, ty) do
if actor.x < tx then
tx -= 1
elseif actor.x > tx then
tx += 1
@matthiasbruns
matthiasbruns / Matchers.java
Created August 12, 2015 13:28
Hamcrest Testing Utils with TextInputLayout support
public class Matchers {
private static final String TAG = Matchers.class.getSimpleName();
public static Matcher<View> withTitle(final String expectedTitle) {
return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
}
@matthiasbruns
matthiasbruns / build.gradle
Last active August 29, 2015 14:13
Gralde jBuildNumber
# .....
# BEFORE
# .....
android.applicationVariants.all { variant ->
variant.mergeResources.dependsOn {
if (project.hasProperty('jBuildNumber')) {
replaceHockeyAppBuildNumber(jBuildNumber)
}
}
/*....*/
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_server_console, null, false);
}
/*....*/
@matthiasbruns
matthiasbruns / gist:6db9ad8b06ca7fd8ab18
Last active August 29, 2015 14:04
Ubuntu 14.x 64Bit Android SDK Dependencies
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
#libz.so.1: cannot open shared object file: No such file or directory
sudo apt-get install lib32z1
@matthiasbruns
matthiasbruns / gist:6777944
Created October 1, 2013 12:50
Spring MVC PUT/DELETE/POST
@RequestMapping(method=RequestMethod.POST, value="/emp")
public @ResponseBody Employee addEmp(@RequestBody Employee e) {
employeeDS.add(e);
return e;
}
@RequestMapping(method=RequestMethod.PUT, value="/emp/{id}")
public @ResponseBody Employee updateEmp(
@RequestBody Employee e, @PathVariable String id) {
employeeDS.update(e);
@matthiasbruns
matthiasbruns / Android - Roboto
Created August 1, 2013 08:59
XML Roboto font settings
android:fontFamily="sans-serif" // roboto regular
android:fontFamily="sans-serif-light" // roboto light
android:fontFamily="sans-serif-condensed" // roboto condensed
android:fontFamily="sans-serif-thin" // roboto thin (android 4.2)
@matthiasbruns
matthiasbruns / Android - Circle Bitmap
Last active December 20, 2015 12:19
Crops the given bitmap to a circle.
public static Bitmap getCroppedBitmap(Bitmap bitmap) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
paint.setAntiAlias(true);