Skip to content

Instantly share code, notes, and snippets.

@fabiomsr
fabiomsr / ByteArray.kt
Last active April 24, 2024 08:41
ByteArray and String extension to add hexadecimal methods in Kotlin
private val HEX_CHARS = "0123456789ABCDEF".toCharArray()
fun ByteArray.toHex() : String{
val result = StringBuffer()
forEach {
val octet = it.toInt()
val firstIndex = (octet and 0xF0).ushr(4)
val secondIndex = octet and 0x0F
result.append(HEX_CHARS[firstIndex])
@cattaka
cattaka / adb-screenshot.sh
Last active December 6, 2017 00:51 — forked from hkurokawa/adb-screenshot.sh
A shell script to take a screen shot of the android device, resize it and copy to clipboard
#! /bin/bash
## This script is for taking a screen shot of an Android device.
## If possible, it tries to resize the image file and then copy to the clipboard.
##
## The script passes unrecognized arguments to adb command, which means you can specify "-e" or "-d"
## to select which device to take a screenshot of.
if [ -z $(which adb) ]; then
echo "Error. adb must be installed and in PATH." 1>&2
@mapyo
mapyo / gist:323c4c62be27ede513d4
Last active August 4, 2016 01:17
Androidの実機でいい感じでキャプチャを取れるようにする方法のメモ

1. AndroidStudio入れる

http://developer.android.com/intl/ja/sdk/index.html

※SDKがどうやって入るのか確認

2. adbコマンドのパスと環境変数の設定

※パス的なものはどこに入ってるのか見て調整する必要があります

echo 'export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools"' >> ~/.bash_profile
echo 'export ANDROID_SDK_HOME="$HOME/Library/Android/sdk"' >> ~/.bash_profile
@sunaot
sunaot / writing_unit_test.md
Last active February 20, 2022 06:57
テストを書くか書かないかの判断の話

ユニットテストでテストを書くか書かないかの判断の話

お題

メソッドの出力の結果が、true か false のどちらでも返ってくる可能性がある場合、assert 文を書く時は true の場合だけで良いのだろうか

テストとは

まず、基本の考えとしてなぜテストをするのか?というのがあります。

@iPaulPro
iPaulPro / include_list_viewpager.xml
Last active March 7, 2024 11:13
CollapsingToolbarLayout with TabLayout
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2015 The Android Open Source Project
~
~ 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
@skyfishjy
skyfishjy / CursorRecyclerViewAdapter.java
Last active December 16, 2023 08:55
CursorRecyclerViewAdapter
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* 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
@cpeppas
cpeppas / gist:b5ffe6bd29b67d96416a
Last active September 1, 2017 17:13
Espresso CustomMatcher to help test things like Actionbar title
import android.view.View;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import static org.hamcrest.Matchers.is;
public class CustomMatchers {
public static Matcher<View> withResourceName(String resourceName) {
@udzura
udzura / tutorial.md
Created June 2, 2014 03:31
Hubot + CoffeeScript ではじめるやわらかプログラミング入門

やわらかプログラミング入門

  • Hubot であそぼう


始めに、地図を描く