Skip to content

Instantly share code, notes, and snippets.

View dylanwatsonsoftware's full-sized avatar

Dylan Watson dylanwatsonsoftware

View GitHub Profile
@dylanwatsonsoftware
dylanwatsonsoftware / post-commit
Last active February 10, 2023 12:23
mvn spotless pre-commit
#!/bin/bash
# Pops the stash created by the pre-commit hook
# This seems to avoid most merge-conflicts created by partially staged files
git stash pop
@dylanwatsonsoftware
dylanwatsonsoftware / ColorGenerator.java
Created June 11, 2015 16:06
Java version of @m1ch4ls C# ColorGenerator
public class ColorGenerator {
public static List<Color> generate(int colors, int skip) {
final int lastindex = colors + skip;
return new Points(colors + skip).asList().subList(skip, lastindex);
}
// RYB color space
private static class RYB {
private static final double[] White = { 1, 1, 1 };
@dylanwatsonsoftware
dylanwatsonsoftware / AndroidNotification.java
Last active December 14, 2015 23:39
A simple method to create an android notification
private void fireNotification(int score) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Hit!")
.setContentText("High Score!")
.setNumber(score)
.setAutoCancel(true);
// Creates an explicit intent for an Activity in your app
@dylanwatsonsoftware
dylanwatsonsoftware / SearchViews.java
Created December 3, 2012 15:13
ActionBarSherlock SearchViews exploration
/*
* Copyright (C) 2011 Jake Wharton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software