This file contains 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
<?php | |
//既存のクラス | |
class Banner { | |
private $string; | |
public function __construct($text) { | |
if (is_string($text)) { | |
$this->string = $text; |
This file contains 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
<?php | |
/** | |
* $textから$start_termと$end_termの間に挟まれた部分を抜き出す関数 | |
* @param type $text 全文字列 | |
* @param type $start_term 抜き出しのスタートとなる文字列 | |
* @param type $end_term 抜き出しの終わりとなる文字列 | |
* @return type 間に挟まれた文字列 | |
*/ | |
function cutText($text,$start_term,$end_term) { |
This file contains 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
window.onload = function() { | |
$.getJSON("http://search.twitter.com/search.json?q='hoge'+OR+'foo'&rpp=5&callback=?", | |
{}, function (data) { | |
$.each(data.results, function (i,v) { | |
var tweet = v.text; | |
tweet = tweet.replace(/(http:\/\/[\x21-\x7e]+)/gi, "<a href='$1'>$1</a>"); | |
tweet = tweet.replace(/#([\x21-\x7e]+)/gi, "<a href=http://twitter.com/#!/search?q=%23$1 target='_blank'>#$1</a>"); | |
tweet = tweet.replace(/@([\x21-\x39\x3b-\x7e]+)/gi, "<a href=http://twitter.com/#!/$1 target='_blank'>@$1</a>:"); | |
$("#tweetList").append(tweet + "<br>"); |
This file contains 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
<?php | |
try { | |
ob_start(); | |
//warningが出るコード | |
$file = file_get_contents('./not_found_file.txt'); | |
$warning = ob_get_contents(); | |
ob_end_clean(); | |
//Warningがあれば例外を投げる | |
if ($warning) { |
This file contains 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
#define redLedPin 3 | |
#define greenLedPin 5 | |
#define blueLedPin 9 | |
#define switchPin 2 | |
int mode = 2; | |
int colorMax = 9; | |
int colorArray[][3]={{255,0,2}, | |
{220,200,0}, | |
{0,255,0}, |
This file contains 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
<?php | |
define('ACCESS_URL', 'http://money.www.infoseek.co.jp/MnForex/fxrate/'); | |
define('END_TERM', '</tr>'); | |
define('HTML_DELIMITER', '</td>'); | |
define('API_KEY', 'hogehoge'); | |
if ($_GET['key'] !== API_KEY || empty($_GET['target']) || !is_string($_GET['target'])) { | |
die(); | |
} |
This file contains 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
/** | |
* 赤外線でシリアル通信(送信)クラス | |
* 注:このクラスを使うとPORTBのピンは使えなくなる | |
* 受信するときは赤外線受光モジュールのVoutをシリアル送信ピンとして扱えばOK | |
*/ | |
class IrTransmitter{ | |
private: | |
//赤外線の1周期ごとの時間(us) | |
unsigned int irCycleTime; | |
//半周期 |
This file contains 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
#include <Wire.h> | |
/** | |
* AquesTalk picoをしゃべらせるクラス(I2C接続) | |
* @param int address デバイスのアドレスを指定 | |
*/ | |
class AquesTalk { | |
private: | |
int address; | |
public: |
This file contains 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
#include <Wire.h> | |
void setup() | |
{ | |
delay(1000); | |
Wire.begin(); | |
} | |
void loop() | |
{ |
This file contains 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
//servo | |
#include <Servo.h> | |
#define SERVO_PIN 9 | |
//negi furi | |
#define DEFAULT_DEG 40 | |
#define NEGIFURI_DEG 70 | |
#define NEGIFURI_WAIT 200 | |
#define NEGIFURI_WAIT_DELAY 400 | |
//spectrum shield | |
#define NOISE_INPUT 160 |