Skip to content

Instantly share code, notes, and snippets.

@nishinoshake
nishinoshake / getLastId.php
Created October 23, 2016 09:02
Laravelで最後に挿入したIDを取得する
// PDO
// http://php.net/manual/ja/pdo.lastinsertid.php
$movieId = DB::getPdo()->lastInsertId();
@nishinoshake
nishinoshake / nginx.conf
Created October 15, 2016 19:39
nginxでphp-fpm
# /var/etc/nginx/nginx.conf
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}
@nishinoshake
nishinoshake / shortcut.sass
Created October 7, 2016 16:52
Sassの省略記法
=min($width: 960px)
@media only screen and (min-width: $width)
@content
.title
+min()
font-size: 2rem
@nishinoshake
nishinoshake / easing.js
Last active September 21, 2016 13:33
easingを関数として使う
// $.easing.easing(null, current_time, start_value, end_value, total_time);
// http://gsgd.co.uk/sandbox/jquery/easing/
// プラグインが必要
var duration = 600;
var startTime = (new Date()).getTime();
// *
// * ループをRAFでまわしたりする
// * valueにeasingが加味された値が返る
// *
@nishinoshake
nishinoshake / laravel.sh
Created September 15, 2016 09:33
Laravelのバージョン指定インストール
composer create-project "laravel/laravel=5.2.*" hoge
@nishinoshake
nishinoshake / noindex.html
Created September 15, 2016 03:30
noindex
<meta name="robots" content="noindex">
https://support.google.com/webmasters/answer/93710?hl=ja
@nishinoshake
nishinoshake / readme.md
Last active September 12, 2016 05:08
formとはいったい

##formとはいったい ユーザからサーバに情報を送信できるようにする仕組み。

##書き方

submit

##重要なこと

@nishinoshake
nishinoshake / back.sql
Created September 2, 2016 11:24
テーブルなどのスキーマの識別子はバッククオートで囲む
SELECT * FROM `select` WHERE `select`.id > 100;
# バッククオートで囲むと予約語も使える
# http://dev.mysql.com/doc/refman/5.6/ja/identifiers.html
@nishinoshake
nishinoshake / make_snippet.sh
Created August 28, 2016 08:53
snippet計算ようのshell
#!/bin/bash
snippet_file='snippet.txt'
window_size=320
# ファイルを空にする
echo -n > ${snippet_file}
for i in {1..40}
do
@nishinoshake
nishinoshake / .htaccess
Created August 23, 2016 11:33
htaccessでフロントコントローラに渡す
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]