Skip to content

Instantly share code, notes, and snippets.

View amay077's full-sized avatar
🏠
Working from home

amay077 amay077

🏠
Working from home
View GitHub Profile
@amay077
amay077 / reactive4javaExample.java
Created September 23, 2011 08:07
Reactive4Java のサンプルコード
Reactive.select(
Reactive.where(
Reactive.range(1, 10), // <---------------- 元のデータソース {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
new Func1<Integer, Boolean>() { // <----- where:偶数だけにフィルタリング
@Override
public Boolean invoke(Integer param1) {
return param1 % 2 == 0;
}
}), new Func1<Integer, Integer>() { // <- select:値を10倍に加工
@Override
@amay077
amay077 / ReactiveSample.cs
Created September 24, 2011 14:39
Reactive Extention(C#)のサンプルコード
Observable.Range(1, 10) // <------------------ 元のデータソース {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
.Where(num => { return num % 2 == 0; }) // <-- 偶数だけにフィルタリング
.Select(num => { return num * 10; }) // <-- 値を10倍に加工
.Subscribe(str => Debug.WriteLine(str)); // <-- 受信した結果をコンソールに出力
// output:
// 20
// 40
// 60
// 80
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.TabbedViewNavigatorSampleHomeView" applicationDPI="160">
<fx:Declarations>
<!-- 非ビジュアルエレメント (サービス、値オブジェクトなど) をここに配置 -->
</fx:Declarations>
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
s|TabbedViewNavigator
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Tab1Label"
actionBarVisible="false">
<fx:Declarations>
<!-- 非ビジュアルエレメント (サービス、値オブジェクトなど) をここに配置 -->
</fx:Declarations>
</s:View>
////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2010 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
@amay077
amay077 / reactive4java_example_old.java
Created August 1, 2012 13:52
reactive4java old sample
Reactive.select(
Reactive.where(
Reactive.range(1, 10),
new Func1<Integer, Boolean>() {
@Override
public Boolean invoke(Integer param1) {
return param1 % 2 == 0;
}
}),
new Func1<Integer, Integer>() {
@amay077
amay077 / reactive4java_example_new.java
Created August 1, 2012 13:53
reactive4java new sample
ObservableBuilder.range(1, 10) // 元のデータソース
.where(new Func1<Integer, Boolean>() { // 偶数だけを抽出
@Override
public Boolean invoke(Integer param1) {
return param1 % 2 == 0;
}
})
.select(new Func1<Integer, Integer>() { // 結果を3倍にする
@Override
public Integer invoke(Integer param1) {
@amay077
amay077 / PutController.m
Created August 24, 2012 09:51
SimpleFtpSample - Disable Keep-Alive
- (void)startSend:(NSString *)filePath
{
BOOL success;
NSURL * url;
assert(filePath != nil);
assert([[NSFileManager defaultManager] fileExistsAtPath:filePath]);
assert( [filePath.pathExtension isEqual:@"png"] || [filePath.pathExtension isEqual:@"jpg"] );
assert(self.networkStream == nil); // don't tap send twice in a row!
@amay077
amay077 / HelloWorld_iPhoneViewController.cs
Created March 14, 2013 14:05
Xamarin.iOS の Tutorial をなんとなくトレースしてみる ref: http://qiita.com/items/bac6621007ecfe7dddb9
namespace HelloWorld_iPhone
{
public partial class HelloWorld_iPhoneViewController : UIViewController
{
protected int _numberOfTimesClicked = 0;
<省略>
public override void ViewDidLoad()
{
@amay077
amay077 / HeavyCalcTask.cs
Created March 18, 2013 11:41
Xamarin の Alpha版で async/await を試す ref: http://qiita.com/items/aa915181ab705374e00f
// HeavyCalc を非同期で実行する AsyncTask
class HeavyCalcTask : Android.OS.AsyncTask
{
private readonly Button button;
public HeavyCalcTask(Button button)
{
this.button = button;
}