Skip to content

Instantly share code, notes, and snippets.

@rtanote
rtanote / bocco-api-ex.py
Last active August 21, 2018 01:18
bocco api pythonライブラリのaudio送信部分の対応例 (api.pyの改修)
# encoding: utf-8
from __future__ import absolute_import
import sys
import uuid
try:
from typing import Any, Dict, List, Optional, Type, Tuple
except:
pass
@rtanote
rtanote / bocco-ex.js
Created July 26, 2018 04:39
bocco.jsで画像送信できるようにしたもの
var sprintf = require('sprintf').sprintf
/** BOCCO へのアクセスAPI
*/
var BOCCO = function(){
this.request = require('request');
this.uuid = require('node-uuid');
this.superagent = require('superagent');
this.speech = require('google-speech-api');
//ルームID
@rtanote
rtanote / i2c_konashi.swift
Last active March 31, 2017 10:30
i2c communication for KX023 in Swift3 + Konashi SDK
//
// ViewController.swift
// KonashiI2CTest
//
// Specification http://kionixfs.kionix.com/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf
import UIKit
import konashi_ios_sdk
extension Data {
//
// KBCollectionExtensions.h
//
// Created by Guy English on 25/02/08.
// Copyright 2008 Kickingbear. All rights reserved.
//
#import <Cocoa/Cocoa.h>
/*
@rtanote
rtanote / routedEvent.xaml
Created June 14, 2013 15:54
Livetを使ったListViewのRoutedEvent処理(ListViewItemのダブルクリックを捕捉してActionを起動する)
// ↓ コードビハインド
<ListView>
<ListView.View>
<!-- リスト -->
</ListView.View>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<EventSetter Event="MouseDoubleClick" Handler="ListViewItem_MouseDoubleClick"/>
</Style>
</ListView.ItemContainerStyle>
@rtanote
rtanote / LinearOriginMinAxis.cs
Last active December 18, 2015 10:08
wpf ToolKit(ver3.5) ChartのLinerAxisの原点を0でなく最小値にする
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls.DataVisualization.Charting;
namespace Views.Chart {
/// <summary>
/// wpf ToolKit Chartの線形軸の原点を0から最小値に変更する
/// </summary>
@rtanote
rtanote / mvvmMessageBox.cs
Created June 10, 2013 03:08
Livetを使ったエラーメッセージ等の実装例
/*
<!-- xmlns:l="http://schemas.livet-mvvm.net/2011/wpf" -->
<i:Interaction.Triggers>
<l:InteractionMessageTrigger MessageKey="Error" Messenger="{Binding Messenger}">
<l:InformationDialogInteractionMessageAction/>
</l:InteractionMessageTrigger>
</i:Interaction.Triggers>
*/
// ViewModel
try {
@rtanote
rtanote / livet-savedlg.cs
Created June 5, 2013 01:01
Livetを使ったファイル保存ダイアログの実装例
/* xaml
<Button Content="export" IsEnabled="{Binding ExportCommand.CanExecute}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<l:SaveFileDialogInteractionMessageAction>
<l:DirectInteractionMessage CallbackCommand="{Binding ExportCommand}">
<l:SavingFileSelectionMessage Filter="{Binding ExportFilter}" />
</l:DirectInteractionMessage>
</l:SaveFileDialogInteractionMessageAction>
</i:EventTrigger>
@rtanote
rtanote / livet-openfiledlg.xaml
Last active December 17, 2015 14:28
Livetを使ったダイアログ表示とVM連携
<!--
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:l="http://schemas.livet-mvvm.net/2011/wpf"
-->
<Button Content="開く" IsEnabled="{Binding OpenCommand.CanExecute}>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<l:OpenFileDialogInteractionMessageAction>
@rtanote
rtanote / map.cs
Created May 19, 2013 02:06
processingのmap関数をC#で使えるように。ジェネリックメソッド&拡張メソッドにしている。
public static class MiscUtils
{
/// <summary>
/// Re-maps a number from one range to another.
/// </summary>
/// <typeparam name="Type">IConvertible-implementing type</typeparam>
/// <param name="value">the incoming value to be converted</param>
/// <param name="start1">lower bound of the value's current range</param>
/// <param name="stop1">upper bound of the value's current range</param>
/// <param name="start2">lower bound of the value's target range</param>