Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

amay077 amay077

🏠
Working from home
View GitHub Profile
@amay077
amay077 / clean.ps1
Created Jan 29, 2018
Script for delete bin/ and obj/ directory in child directories.
View clean.ps1
$dirs = Get-ChildItem -Recurse * | ? { $_.PSIsContainer} | % { $_.FullName} | grep -e bin$ -e obj$
foreach ($dir in $dirs) {
# echo $dir
rm -rf $dir
}
@amay077
amay077 / whitelist.md
Last active Jan 22, 2018 — forked from okohs/whitelist.md
20180122_定時前に帰宅できた企業
View whitelist.md

はじめに

書き方

該当する各社の対応欄に企業名を書いてください。備考があれば適宜カッコ書きしてください。

目的

  • 定時前に帰宅させてくれるホワイトな会社を気軽に作りたい
  • 定時前に帰宅させてくれるホワイトな会社がホワイトアピールできる場があれば良いな

@amay077
amay077 / firstIndexOrNull.kt
Created Dec 6, 2017
firstIndexOrNull in Kotlin collections
View firstIndexOrNull.kt
inline fun <T> Iterable<T>.firstIndexOrNull(predicate: (T) -> Boolean): Int? {
return this.mapIndexed { index, place -> Pair(index, place) }
.firstOrNull() { predicate(it.second) }
?.first
}
@amay077
amay077 / ObservableExtensions.kt
Created Nov 9, 2017
Convert RxJava:Observable<T> to AAC:LiveData<T>
View ObservableExtensions.kt
package your.awesome.package
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.MutableLiveData
import io.reactivex.Observable
import io.reactivex.disposables.Disposable
fun <T> Observable<T>.toLiveData() : LiveData<T> {
return object : MutableLiveData<T>() {
@amay077
amay077 / LiveDataExtensions.kt
Created Nov 2, 2017
LiveData.observe is NOT onChanged.
View LiveDataExtensions.kt
package your.awesome.package
fun <T> LiveData<T>.observeOnChanged(owner : LifecycleOwner, observer : Observer<T>) : Unit {
var prev : T? = null
this.observe(owner, Observer<T> {
if (!(prev?.equals(it) ?: false)) {
observer.onChanged(it)
}
prev = it
})
@amay077
amay077 / LayoutTestPage.xaml
Created Mar 17, 2017
Xamarin.Forms で上下等間隔2分割のレイアウトを行うサンプル
View LayoutTestPage.xaml
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:SepTest" x:Class="LayoutTest.LayoutTestPage">
<ContentPage.Content>
<!--Grid を使う方法-->
<!--
<Grid HorizontalOptions="Fill" VerticalOptions="Fill">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
View KeyboardOverlapRenderer.cs
using System;
using Xamarin.Forms.Platform.iOS;
using Foundation;
using UIKit;
using Xamarin.Forms;
using CoreGraphics;
using KeyboardOverlap.Forms.Plugin.iOSUnified;
using System.Diagnostics;
[assembly: ExportRenderer(typeof(Page), typeof(KeyboardOverlapRenderer))]
@amay077
amay077 / <= Forms 2.3.2
Created Jan 11, 2017 — forked from jimmgarrido/AdjustResize.md
AdjustResize Workaround for Xamarin.Forms
View <= Forms 2.3.2
protected override void OnCreate(Bundle bundle)
{
ToolbarResource = Resource.Layout.toolbar;
TabLayoutResource = Resource.Layout.tabs;
base.OnCreate(bundle);
Window.SetSoftInputMode(SoftInput.AdjustResize);
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
@amay077
amay077 / XFGoogleMapSample.csproj
Created Dec 16, 2016
ビルド前イベントで「特定のファイルが無ければコピーする」を Win:Visual Studio/Mac:Xamarin Studio(Visual Studio for Mac) で行う。< PreBuildEvent > を見てね。
View XFGoogleMapSample.csproj
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E5FEBCA7-6127-4002-B7B3-3EE4CC362B25}</ProjectGuid>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<UseMSBuildEngine>true</UseMSBuildEngine>
<OutputType>Library</OutputType>
<RootNamespace>XFGoogleMapSample</RootNamespace>
@amay077
amay077 / CustomBackButtonMasterDetailEffect.cs
Last active Jul 20, 2016
Xamarin.Forms の MasterDetailPage の左上ボタンをカスタマイズする Effect(iOSのみ)
View CustomBackButtonMasterDetailEffect.cs
using System;
using System.Collections.Generic;
using System.Linq;
using UIKit;
using NavigationSample.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ResolutionGroupName("mycompany")]
[assembly: ExportEffect(typeof(CustomBackButtonMasterDetailEffect), "CustomBackButtonMasterDetailEffect")]