Skip to content

Instantly share code, notes, and snippets.

View hiyorineko's full-sized avatar

いいね(iine) hiyorineko

View GitHub Profile
@hiyorineko
hiyorineko / index.php
Created January 29, 2020 00:13
LINEBot_reply_min
<?php
const CHANNEL_ACCESS_TOKEN = '[取得したCHANNEL ACCESS TOKEN]';
$entityBody = file_get_contents('php://input');
$data = json_decode($entityBody, true);
foreach ($data['events'] as $event) {
switch ($event['type']) {
case 'message':
@hiyorineko
hiyorineko / index.php
Created January 28, 2020 08:23
LINEbot_sample
<?php
const CHANNEL_ACCESS_TOKEN = '[取得したCHANNEL ACCESS TOKEN]';
$entityBody = file_get_contents('php://input');
$data = json_decode($entityBody, true);
foreach ($data['events'] as $event) {
switch ($event['type']) {
case 'message':
function isIsogram($string) {
foreach (range('a','z') as $let){
if (substr_count(strtolower($string), $let) > 1){return false;}
}
return true;
}
function accum($s) {
$result = array();
for ($i = 0; $i < strlen($s); $i++) {
$str = "";
for ($j = 0; $j <= $i; $j++) {
$str = $str . $s[$i];
}
$result[] = ucfirst(strtolower($str));
}
return implode("-", $result);
@hiyorineko
hiyorineko / formdata
Last active March 18, 2016 06:21
SUBMIT一つで一括更新したい
_method:PUT
id:1
種類:キャラ
レアリティ:R
色:青
カード名:なでこスネーク
lv:1
コスト:1
パワー:6000
メモ:
@hiyorineko
hiyorineko / Controller.php
Created March 15, 2016 07:27
cakephpの課題
public function stock()
{
//モデルからテーブルを取得
$monogataris = $this->Monogataris->find('all');
//ビューの$monogatarisへ取得したエンティティをセット
$this->set(compact('monogataris'));
if ($this->request->is(['post', 'put'])) {
$id = $this->request->data('id');
$monogatari = $this->Monogataris->get($id);
@hiyorineko
hiyorineko / AsyncHttpRequest.java
Last active March 7, 2016 07:31
Jsoupでhtmlパース。img srcタグを抽出。
@Override
protected String doInBackground(Uri.Builder... builder) {
try {
document = Jsoup.connect("http://ws-tcg.com/ws_today").get();
return "成功";
}catch(IOException e){
return "失敗";
}
}
<?php
echo "Hello Java!";
?>
@hiyorineko
hiyorineko / PackageTest.java
Created January 25, 2016 07:23
パッケージの使い方やっとわかった
package com.exam;
public class PackageTest{
private int i = 1000;
public int show(){
return i;
}
}
@hiyorineko
hiyorineko / onCreate.java
Created January 22, 2016 02:34
ビューのフリック
ImageView iv;
TextView tv;
// X軸最低スワイプ距離
private static final int SWIPE_MIN_DISTANCE = 50;
// X軸最低スワイプスピード
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
// Y軸の移動距離 これ以上なら横移動を判定しない
private static final int SWIPE_MAX_OFF_PATH = 250;