Skip to content

Instantly share code, notes, and snippets.

View ryuchan00's full-sized avatar

Ryutaro Yamakawa ryuchan00

View GitHub Profile
@ryuchan00
ryuchan00 / test.php
Created February 26, 2017 09:23
test_gist
<?
echo "Hello,World";
require 'net/https'
require 'uri'
require 'json'
client_id = ''
client_secret = ''
topic_id = ''
msg = 'Hello!'
# setup a http client
@ryuchan00
ryuchan00 / file0.txt
Created July 19, 2017 12:50
【超初心者向け】AWSでたてたnginxサーバーにドメインを設定する ref: http://qiita.com/yamakawa00/items/3e172fbfd1044e093c52
[user|~]$ cd /etc/nginx/conf.d/
[user|conf.d]$ sudo vi xxx.conf #xxxは自分のアプリケーション名でファイル名変更
field = [[1,2],[3,4]]
# 連結
# 12
# 34
field.each { |f| puts f.join("")}
array = [nil, 1, 2, 3, nil]
# nilを削除して計算
p array.compact.inject(&:+) # 6
<?php
$keyword_uppercase = 'XYZ';
$keyword_lowercase = 'xyz';
$text1 = 'abcXYZ';
$text2 = 'abcXYZabcXYZ';
// mb_strposの挙動
// 大文字は文字は含まれていると判定される
<?php
$keyword_uppercase = 'XYZ';
$keyword_lowercase = 'xyz';
$text1 = 'abcXYZ';
// mb_striposの挙動
// 大文字は文字は含まれていると判定される
if (mb_stripos($text1, $keyword_uppercase) === false) {
<?php
// mbstrposの誤判定
$keyword2 = 'DEF';
$text2 = 'DEFghi';
// 含まれていないと判定される
// mb_strposの戻り値が'0'の場合、誤判定するため
// mb_strposの判定は'==='で行うこと
if (mb_strpos($text2, $keyword2) == false) {
@ryuchan00
ryuchan00 / file0.txt
Created August 6, 2017 10:16
S3にアップロードしようと思ったら、時計がズレていたので失敗した。 ref: http://qiita.com/yamakawa00/items/79d18852a5cfcfc37018
The difference between the request time and the current time is too large.
@ryuchan00
ryuchan00 / file0.txt
Created September 29, 2017 03:29
ubuntuでpostgres導入に失敗した時の解決策 ref: http://qiita.com/yamakawa00/items/734f6f89ceaac537fa4c
$ sudo apt-get update
$ sudo apt-get install postgresql-9.5
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
E: パッケージ postgresql-9.5 が見つかりません
E: 正規表現 'postgresql-9.5' ではパッケージは見つかりませんでした