Skip to content

Instantly share code, notes, and snippets.

@ka2n
ka2n / gist:2863673
Created June 3, 2012 14:14
guardで監視してJSXをコンパイルしてlivereload
# Guardfile
# livereload and compile .jsx
guard :shell do
watch(/(.+)\.jsx/) {|m| `./node_modules/jsx/bin/jsx --output #{m[1]}.js #{m[0]}` }
end
guard 'livereload' do
watch(/.jsx/)
end
@ka2n
ka2n / config
Created September 2, 2012 04:18
PHP CodeSniffer pre-commit hook for git. Works nicely with https://github.com/klaussilveira/phpcs-psr.
# path to phpcs "binary"
PHPCS_BIN=/usr/bin/phpcs
# the coding standard, you can also specify a path to your own standard here
# e. g. /path/to/my/standard/dir/
PHPCS_CODING_STANDARD=PSR
# comma-separated list of file patterns being ignored
PHPCS_IGNORE=
@ka2n
ka2n / gist:4166772
Created November 29, 2012 04:10
MT Style Post Name
<?php
/*
* Plugin Name: MT Style Post Name
* Description: タイトルから英数字、ダッシュ、アンダーバーのみ抜き取ってスラッグに。日本語しか使われてないエントリはPost_IDを使う。
* Author: 449
* Plugin URI: http://pc10.2ch.net/test/read.cgi/blog/1163599919
* Version: 0.1
* */
add_filter('sanitize_title','sanitize_title_numalpha_only',9);
@ka2n
ka2n / gist:4985270
Last active December 13, 2015 22:29
OpenLayers.LonLat projection transformation(EPSG:4326 <=> EPSG:900913)
var p4, p9;
p4 = new OpenLayers.Projection('EPSG:4326');
p9 = new OpenLayers.Projection('EPSG:900913');
var v, p4_lat,p4_lon, p9_lat, p9_lon;
v = new OpenLayers.LonLat( 135, 35);
p4_lat = v.lat;
p4_lon = v.lon;
// 値を確認
@ka2n
ka2n / .tmux.local
Created April 26, 2013 13:14
tmuxを起動した時にアプリケーションの最新のログ(これはFuelPHP)とapacheのログをtailしておく
new-window -d -n log -t :2
split-window -t log -h
split-window -t log -v -t server.0
split-window -t log -v -t server.1
send-keys -t server.1 'tail -f `find ./workspace/proj/app/logs/ -type f -print | tail -1`' C-m
send-keys -t server.3 'tail -f /var/log/apache2/error_log' C-m
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
@ka2n
ka2n / pre-commit
Last active December 26, 2015 02:29
pre-commit hook to check source code syntax PHP, Coffee, Sass
#!/bin/bash
checkPHP=1
checkCoffee=1
checkSass=1
PHP=`which php`
COFFEE=`which coffee`
SASS=`which sass`
@ka2n
ka2n / Dockerfile
Last active January 2, 2016 17:39
Dockerを使ってWebアプリケーションをデプロイする ref: http://qiita.com/ka2n/items/9659cb2b083ab7dcd844
# baseイメージからスタート
FROM ka2n/base
###### アプリケーションをセットアップ #####
# アプリケーションのコードをコンテナの/appに追加
ADD /src /app
# インストール(`bundle install`とか`npm install`とか)
RUN pip install /app
import React from 'react'
import { PropTypes } from 'react'
import { throttle } from 'lodash'
export default class InfiniteList extends React.Component {
static propTypes = {
initialElements: PropTypes.arrayOf(PropTypes.node),
endElement: PropTypes.node,
moreElement: PropTypes.node,

Keybase proof

I hereby claim:

  • I am ka2n on github.
  • I am ka2n (https://keybase.io/ka2n) on keybase.
  • I have a public key ASA7tKkMG1owTq0T0rWKOZtsoWegDOXfSO3nmLsh4m4RBgo

To claim this, I am signing this object: