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
/* | |
* 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 | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
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
private int _darkenOrLightenColor(int color, boolean darken) { | |
float[] hsv = new float[3]; | |
Color.colorToHSV(color, hsv); | |
// value component | |
if (darken) { | |
hsv[2] *= Math.max(hsv[2] * 0.99f, 0); | |
} else { | |
hsv[2] = Math.max(hsv[2] * 1.5f, 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
package co.kaush.mystarterapp.myappmodule.ui.transformations; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapShader; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.Shader; | |
import com.squareup.picasso.Transformation; |
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 android.os.Handler; | |
import android.os.Looper; | |
import com.squareup.otto.Bus; | |
import com.squareup.otto.ThreadEnforcer; | |
import java.util.HashSet; | |
import java.util.Set; | |
/* |
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 android.os.Bundle; | |
// see my gist for [https://gist.github.com/kaushikgopal/9eea148a2188dc58fe37](ParcelableSparseArray) implementation | |
public class Bundler { | |
private Bundle _bundle; | |
public Bundler() { | |
_bundle = new Bundle(); |
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 android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
import com.micromobs.pkk.R; | |
import com.micromobs.pkk.ui.adapters.viewholders.ViewHolder; | |
/** | |
* 1. reusableView (convertView) caching from the Android framework |
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 android.text.SpannableStringBuilder; | |
import java.util.ArrayDeque; | |
import java.util.Deque; | |
import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE; | |
/** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */ | |
public class Truss { |
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 android.content.Intent; | |
import android.os.Bundle; | |
import android.os.Parcel; | |
import android.os.Parcelable; | |
import android.util.SparseArray; | |
import junit.framework.TestCase; | |
public class ParcelableSparseArray | |
extends SparseArray<Object> |
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
# First check imagemagick versions | |
brew versions imagemagick | |
brew uninstall imagemagick | |
cd /usr/local/Cellar | |
git checkout 834ce4a /usr/local/Library/Formula/imagemagick.rb | |
brew install imagemagick |
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
#!/usr/bin/env ruby | |
# Get line number for file that needs to be added | |
argument = ARGV.pop | |
# do a git status and get the second argument | |
# filename = %x[git status -s | sed -n '#{argument}p'].split(" ", 2)[1] | |
filename = %x[git status -s | awk 'NR==#{argument}'].split(" ", 2)[1] # using awk baby! | |
system("git checkout -- #{filename}") |