$ irb irb(main):001:0> RUBY_VERSION => "1.9.3" irb(main):002:0> "I"[0] => "I" ← あれ?1.8の時はこれで文字コード取得できなかったっけ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ordinal indicator sample | |
// see also... http://en.wikipedia.org/wiki/Ordinal_indicator#English | |
// | |
String getOrdinalIndicatorStr(int num) { | |
String result; | |
int d1 = num % 10; | |
int d2 = num % 100; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// weather_json_sample.pde - 天気予報を表示するスケッチ例 | |
// | |
// 天気予報JSONデータについては下記参照 | |
// http://weather.livedoor.com/weather_hacks/webservice | |
// | |
String url = "http://weather.livedoor.com/forecast/webservice/json/v1?city=130010"; | |
JSONObject json; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Serial.println(buf); | |
// | |
// dht11_dht22_cds_pir_test.ino - a sample sketch that outputs the sensor data in JSON.. | |
// | |
// This program uses the following libraries.// | |
// https://github.com/adafruit/DHT-sensor-library | |
// | |
#include "DHT.h" | |
#define CDS_PIN 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// dht11_dht22_cds_test.ino - a sample sketch that outputs the sensor data in JSON.. | |
// | |
// This program uses the following libraries.// | |
// https://github.com/adafruit/DHT-sensor-library | |
// | |
#include "DHT.h" | |
DHT dht11(2, DHT11); | |
DHT dht22(3, DHT22); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# -*- encoding: utf-8 -*- | |
# | |
# mqtt_sensor_pub.rb - Sample script to publish the sensor data using the MQTT | |
# | |
# $ sudo gem install serialport | |
# $ sudo gem install mqtt | |
# | |
require 'rubygems' | |
require 'serialport' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# -*- encoding: utf-8 -*- | |
# | |
# sensor_gruff.rb - create line charts & upload images to gyazo | |
# | |
# $ sudo apt-get install rmagic libmagickcore-dev libmagickwand-dev | |
# $ sudo gem install gruff | |
# $ gem install gyazo | |
# | |
require 'rubygems' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spawn = require('child_process').spawn | |
module.exports = (robot) -> | |
robot.respond /nike$/i, (msg) -> | |
msg.send 'https://farm8.staticflickr.com/7118/7446163748_fd8ace754f_m.jpg' | |
robot.respond /sensor$/i, (msg) -> | |
output = '' | |
ls = spawn('./sensor.rb') | |
ls.stdout.on 'data', (data) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fisica.*; | |
FWorld world; | |
void setup() { | |
size(400, 400); | |
smooth(); | |
Fisica.init(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// mqtt_pub_dht11.ino - mqtt publish sample for Arduino Ethernet | |
// | |
// This program uses the following libraries. | |
// https://github.com/knolleary/pubsubclient | |
// https://github.com/virtuabotix/DHT11LIB | |
// | |
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <PubSubClient.h> |