Skip to content

Instantly share code, notes, and snippets.

@nishinoshake
nishinoshake / readme.md
Created July 10, 2016 11:13
foreverでデーモンの死活監視

##なぜ使うか ふつうにnodeコマンドで実行した場合、プロセスが死んだらそのまま。
foreverを使えば死活監視をして、プロセスを再起動してくれる。

https://github.com/foreverjs/forever

@nishinoshake
nishinoshake / command.sh
Last active July 10, 2016 13:37
nginxの設定と起動
# apacheと同じでサービスコマンドでデーモンを起動したり停止したり
sudo service nginx start
sudo service nginx stop
sudo service nginx restart
# 自動起動も同じ
sudo chkconfig nginx on
sudo chkconfig nginx off
@nishinoshake
nishinoshake / sprite.js
Created July 4, 2016 03:26
背景ズラして連続スプライト画像
Index.flipImage = function() {
var index = 0;
var column = 5;
var fps = 30;
var length = 70;
var width = 150;
var height = 150;
(function render() {
var x = - (index % column) * width;
@nishinoshake
nishinoshake / color.css
Created June 28, 2016 07:13
グラデーションで左右に違う色
.sample {
background-image: linear-gradient(to top, #e91d25, #e91d25), linear-gradient(to top, #929497, #929497);
background-position: left top, right top;
background-repeat: no-repeat, no-repeat;
background-size: 50% 100%, 50% 100%;
}
@nishinoshake
nishinoshake / readme.md
Last active June 22, 2016 12:57
GLSLがわからん

##GLSL webGL Shader Language シェーダを記述するための言語
書き方はほとんどC言語

##シェーダってなにさ 3Dモデルを構築するのに必要な概念 ざっくりいえば位置を決める頂点シェーダと、
色を決めるフラグメントシェーダがある。

@nishinoshake
nishinoshake / readme.txt
Created June 21, 2016 02:41
Javascriptにおける参照渡し
プリミティブ型は値渡し。
オブジェクトは参照渡しになる。
関数の中でオブジェクトをいじったらもとのオブジェクトもかわる。
値を渡してるわけじゃないので当たり前ですが・・・びっくり。
@nishinoshake
nishinoshake / animation.js
Last active July 10, 2016 13:40
生のWebGLがわからん
(function render(){
// canvasを初期化
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clearDepth(1.0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
// カウンタをインクリメントする
count++;
// カウンタを元にラジアンを算出
@nishinoshake
nishinoshake / increment.js
Last active June 19, 2016 06:22
Reduxがわからん
import React, {PropTypes} from 'react'
import { render } from 'react-dom'
import { createStore } from 'redux'
import { Provider } from 'react-redux'
import { connect } from 'react-redux'
// Action Creator
function increment() {
return {
type: 'INCREMENT'
@nishinoshake
nishinoshake / readme.md
Last active July 27, 2016 09:10
FTPの制限ユーザ作成

##制限の考え方 ユーザ毎ログインディレクトリを変更することで、
ルートなどの危ないところにはアクセスさせ内容にする。

ファイルの場所 => /etc/vsftpd/

FTPを使うのはWebサーバ用にファイルをアップする目的だと思うので、 FTPのためだけにユーザを作成せずに、バーチャルユーザを作成し、 そいつをapacheなどのユーザに化けさせて接続させてあげると、 Webサーバのユーザとファイルの所有者などがごちゃごちゃにならずによい。

@nishinoshake
nishinoshake / readme.md
Last active August 18, 2016 09:30
Laravelがわからん

##Laravelとは ウェブ職人のためのPHPフレームワーク

##シンプルな流れ ユーザ ↓ Request リクエストの処理(POSTを変数にいれたり) ↓ Middleware 事前処理(CSRFとか認証とか) ↓