Skip to content

Instantly share code, notes, and snippets.

View hika09's full-sized avatar

hikaru-takase hika09

View GitHub Profile
module.exports = (robot) ->
#バスの時刻表テーブルを定義
bus_week = [354,365,374,385,395,404,412,419,426,432,437,444,452,460,468,475,483,490,496,503,510,518,525,534,544,552,564,574,587,605,618,632,646,663,676,692,713,732,753,773,789,806,820,834,849,863,877,891,905,918,929,938,949,959,968,977,985,993,1002,1010,1018,1029,1037,1049,1059,1069,1078,1089,1099,1109,1119,1128,1138,1148,1158,1168,1178,1188,1198,1208,1218,1228,1237,1247,1260,1272,1287,1300,1311,1320,1330,1340,1350,1360]
bus_sat = [383,391,399,406,413,421,432,443,454,465,476,487,498,509,520,531,544,558,572,586,601,617,633,649,664,681,696,713,727,745,763,779,796,813,830,847,864,881,898,913,924,935,946,958,970,983,996,1010,1025,1038,1052,1066,1080,1093,1107,1122,1135,1148,1162,1178,1190,1207,1222,1237,1252,1268,1283,1299,1314,1329,1359]
bus_sun = [383,395,407,420,435,452,468,484,500,516,533,551,567,585,603,620,638,656,674,692,710,727,745,760,775,792,808,824,839,854,869,884,899,914,929,944,959,974,989,1004,1019,1034,1049,1064,1079,1092,1108,1123,1137,1151,1165,
robot.respond /天気/i, (res) ->
request = robot.http("http://weather.livedoor.com/forecast/webservice/json/v1?city=調べたい地域ID").get()
request (err, mes, body) ->
json = JSON.parse body
message_row = "今日の天気は#{json.forecasts[0].telop}です。#{json.description.text}"
message = message_row.replace(/\r?\n|[ ]/g,"")
console.log(message)
say(res, message)
module.exports = (robot) ->
@cron = require('cron').CronJob
#=========================
#Define cron job
#=========================
#ゴミの日の発話
#@param res [obj] res,robotのhubotオブジェクトを渡す
moning_task = (res) ->
<section>
<a href="<?php the_permalink(); ?>">
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
</a>
</section>
//====================================
//get_posts()タグを使用した記事情報の取得方法
//====================================
<?php
$args = array(
'post_type' => 'your-custompost-name', // 投稿タイプを指定
'posts_per_page' => 5 // 表示するページ数
);
$the_query = get_posts( $args );
//====================================
//WP_Query()クラスを使用した記事情報の取得方法
//====================================
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // 現在のページを変数に設定
$args = array(
'post_type' => 'your-custompost-name', // 投稿タイプを指定
'posts_per_page' =>5, // 表示するページ数
'paged' => $paged, // 表示するページ数
<title>
<?php
global $page, $paged;
//個別ページタイトルとサイトタイトルを表示
if (is_search()) :
wp_title('', true, 'left');
echo ' | ';
else :
wp_title(' | ', true, 'right');
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>サイトのタイトル</title>
<?php
//サムネイルフィールドを追加する場合は必須
add_theme_support('post-thumbnails');
//カスタム投稿の実装
add_action('init', 'register_custompost');
//カスタム投稿の定義
function register_custompost() {
register_post_type(
register_post_type(
'customPostName',
array(
'labels' => array(
'name' => 'カスタムポスト',
'add_new_item' => 'カスタムポストの追加',
'edit_item' => 'カスタムポストの編集'
),
'public' => true,
'supports' => array(