Skip to content

Instantly share code, notes, and snippets.

View YasushiKobayashi's full-sized avatar

YasushiKobayashi YasushiKobayashi

View GitHub Profile
@YasushiKobayashi
YasushiKobayashi / node-babel.md
Last active May 3, 2017 10:41
nodejs with es6

node -r babel-register node.js

@YasushiKobayashi
YasushiKobayashi / express.md
Last active May 3, 2017 11:06
use nodejs express server

setup

import express from 'express';
const app = express();

routing

app.get('*', (req, res) => {
 const title = 'title';
@YasushiKobayashi
YasushiKobayashi / react-fontsize.md
Last active May 3, 2017 11:04
react use em fontsize
// can not
fontSize: '0.8em',

// can use
'font-size': '0.8em',

// px
fontSize: 16,
@YasushiKobayashi
YasushiKobayashi / server.jsx
Created May 4, 2017 06:17
最低限のreact router と連動したSSR
import express from 'express';
import React from 'react';
import { match, RouterContext } from 'react-router';
import { renderToString } from 'react-dom/server';
import routes from './routes';
import config from './config';
const app = express();
@YasushiKobayashi
YasushiKobayashi / gulp.bable.js
Last active May 5, 2017 12:59
gulp.bable.js
import gulp from 'gulp';
import eslint from 'gulp-eslint';
import babel from 'gulp-babel';
import coffeelint from 'gulp-coffeelint';
import uglify from 'gulp-uglify';
import babelify from 'babelify';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
import transform from 'vinyl-transform';
@YasushiKobayashi
YasushiKobayashi / webpack.config.babel.js
Created May 6, 2017 05:56
ディレクトリ構成を維持しつつwebpackで複数ファイルをビルドする(nodejs用)
import webpack from 'webpack';
import path from 'path';
import glob from 'glob';
import nodeExternals from 'webpack-node-externals';
import loaders from './webpack.loaders';
const jsBasePath = path.resolve(__dirname, './');
const targetDirectories = ['es'];
@YasushiKobayashi
YasushiKobayashi / nodenv.sh
Last active February 14, 2019 15:37
install nodejs with nodenv
#!/bin/sh
brew install nodenv yarn
nodenv install 6.7.0
nodenv rehash
nodenv global 6.7.0
echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(nodenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
@YasushiKobayashi
YasushiKobayashi / rule.md
Last active May 7, 2017 20:58
module import rules vender(glide)

dir

src/app
│ 
├── handler
│   ├── handler.go
├── glide.lock
├── glide.yaml
├── main.go
└── vendor
@YasushiKobayashi
YasushiKobayashi / action.js
Created June 8, 2017 16:24
reduxでmiddlewareを使わない非同期処理
export function isLogin() {
return async (dispatch) => {
try {
const user = await User.get('user');
dispatch({
type: actionTypes.LOADED,
isLoading: false,
isLogin: true,
user,
});
@YasushiKobayashi
YasushiKobayashi / gist:9f82aa43ed2779350aed13550a009385
Last active July 13, 2017 09:42
vimでTextExpanderを使えるようにする

~/Dropbox/TextExpander/Settings.textexpander
or
~/Library/Application\ Support/TextExpander/Settings.textexpander

add

<key>forcePasteBundleIDs</key>
<array><string>org.vim.MacVim</string></array>