Skip to content

Instantly share code, notes, and snippets.

View takahirom's full-sized avatar

Takahiro Menju takahirom

View GitHub Profile
@Aracem
Aracem / ParallaxPageTransformer.java
Last active March 8, 2023 17:28
Parallax transformer for ViewPagers that let you set different parallax effects for each view in your Fragments.
package com.aracem.utils.animations.pagetransformation;
import org.jetbrains.annotations.NotNull;
import android.support.v4.view.ViewPager;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
@mstssk
mstssk / .gti.sh
Last active August 29, 2015 14:06
alias gti=~/.gti.sh
#!sh
# Re-concatenate command. Care quoted arguments.
command="git"
while [ "$1" != "" ]
do
space_contain=`echo $1 | grep "\s"`
if [ "" != "$space_contain" ]
then
command="$command \"$1\""
@JakeWharton
JakeWharton / .bash_profile
Created August 7, 2014 05:49
Merge all your branches into a hacking branch.
function hackhackhack() {
# Merge all your local branches into a hacking branch.
PREFIX="$(whoami)/"
git co master
git branch -D "${PREFIX}hackhackhack"
git pull --prune
git co -b "${PREFIX}hackhackhack"
for branch in $(git branch | \grep "$PREFIX"); do
git merge --no-edit $branch
done
@daniellevass
daniellevass / android_material_design_colours.xml
Last active June 5, 2024 13:54
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>

CustomerActivity.java

public class CustomerActivity extends Activity implements ICustomerView, OnClickListener {

	private EditText mFirstNameEditText, mLastNameEditText, mIdEditText;
	private Button mSaveButton, mLoadButton;
	private CustomerPresenter mCustomerPresenter;

	@Override

protected void onCreate(Bundle savedInstanceState) {

@romannurik
romannurik / CheatSheet.java
Last active May 16, 2023 13:42
Android helper class for showing cheat sheets (tooltips) for icon-only UI elements on long-press. This is already default platform behavior for icon-only action bar items and tabs. This class provides this behavior for any other such UI element.
/*
* Copyright 2012 Google Inc.
*
* 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
@JakeWharton
JakeWharton / AspectRatioImageView.java
Created June 2, 2012 02:14
ImageView that respects an aspect ratio applied to a specific measurement.
// Copyright 2012 Square, Inc.
package com.squareup.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/** Maintains an aspect ratio based on either width or height. Disabled by default. */
public class AspectRatioImageView extends ImageView {
@aprock
aprock / gist:2037883
Created March 14, 2012 17:00
manually serialize/deserialize android bundle
private String serializeBundle(final Bundle bundle) {
String base64 = null;
final Parcel parcel = Parcel.obtain();
try {
parcel.writeBundle(bundle);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final GZIPOutputStream zos = new GZIPOutputStream(new BufferedOutputStream(bos));
zos.write(parcel.marshall());
zos.close();
base64 = Base64.encodeToString(bos.toByteArray(), 0);
@webdevwilson
webdevwilson / compare-and-copy-files.groovy
Created January 19, 2011 15:55
Groovy code to compare to directory trees and copy different files over
def path1 = new File(args[0]).absolutePath
def path2 = new File(args[1]).absolutePath
def different = compareDirs(path1, path2)
different.files.each {
println it.from
new AntBuilder().copy ( file: it.from.absolutePath, tofile : it.to.absolutePath )
}
println different.files.size() + ' of ' + different.count