Skip to content

Instantly share code, notes, and snippets.

View nukosuke's full-sized avatar
🍊
🐈 🐈 🐈

nukosuke nukosuke

🍊
🐈 🐈 🐈
View GitHub Profile
import * as Koa from "koa";
import * as React from "react";
import * as ReactDOM from "react-dom/server";
import { StaticRouter } from "react-router-dom";
import { Helmet } from "react-helmet";
import Application from "./components/Application";
const app = new Koa();
// StaticRouterにKoaのコンテキストからURLを渡し、
import * as React from "react";
import { Switch, Route, Link } from "react-router-dom";
export default class Application extends React.Component<any, any> {
render() {
return (
<div>
<ul>
<li><Link to="/1">page 1</Link></li>
<li><Link to="/2">page 2</Link></li>
import * as Koa from "koa";
import * as React from "react";
import * as ReactDOM from "react-dom/server";
import { Helmet } from "react-helmet";
import Application from "./components/Application";
const app = new Koa();
app.use(ctx => {
const markup = ReactDOM.renderToString(<Application/>);
import * as path from "path";
import * as Koa from "koa";
import * as staticFiles from "koa-static";
import * as React from "react";
import * as ReactDOM from "react-dom/server";
import { StaticRouter } from "react-router-dom";
import { Helmet } from "react-helmet";
import Application from "./components/Application";
const app = new Koa();
@nukosuke
nukosuke / react-universal.md
Last active May 22, 2018 06:57
React Universalアプリケーション勉強会

概要

React Universalアプリケーション勉強会のための覚書。

Universal

isomorphic(あいそもーふぃっく)とも言う。クライアントでもサーバでも同じようにレンダリングされ動作するアプリケーションのこと。 最近ではReact Nativeなどを使ったモバイルアプリケーションも含めUniversalと言うことが多い。

技術スタック

使用する技術スタックは次の通り。

@nukosuke
nukosuke / progressbar.vb
Created May 1, 2017 07:12
progressbar macro for PowerPoint
Sub progressbar()
Const r As String = "00" '色・RGB値のR
Const g As String = "ae" '色・RGB値のG
Const b As String = "ef" '色・RGB値のB
Const pbH As Long = 10 '高さ
Const pbBG As Single = 0.6 '背景の透過性
Const bgr As String = "ff"
Const bgg As String = "be"
Const bgb As String = "00"
@nukosuke
nukosuke / install-emacs-macos.sh
Last active March 8, 2019 03:04
Install emacs on macOS
#!/bin/sh
git clone https://git.savannah.gnu.org/git/emacs.git
cd emacs
./configure --with-ns --with-mailutils --without-makeinfo --with-module
make -j8
sudo make install
@nukosuke
nukosuke / railsContextReducer.js
Created February 8, 2017 09:03
react_on_rails, react-router, redux
export default function railsContextReducer(state = {}) {
return state;
}
@nukosuke
nukosuke / application.html.erb
Created February 8, 2017 08:54
react_on_rails, react-router, redux
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<%= server_render_js("Helmet.rewind().title.toString()") %>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all' %>
</head>
<body>
<%= yield %>
@nukosuke
nukosuke / clientRegistration.js
Created February 8, 2017 08:51
react_on_rails, react-router, redux
import React from 'react';
import { Provider } from 'react-redux';
import { Router as ReactRouter, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import ReactOnRails from 'react-on-rails';
import routes from '../routes/routes';
import store from '../store/store';
const Router = (props, railsContext) => {
const store = ReactOnRails.getStore("store");