Skip to content

Instantly share code, notes, and snippets.

View saitoxu's full-sized avatar

Yosuke Saito saitoxu

View GitHub Profile
@saitoxu
saitoxu / commands.sh
Last active March 22, 2018 04:09
how to install node_exporter (CentOS 7.4)
$ sudo su -
$ cd /opt
$ wget https://github.com/prometheus/node_exporter/releases/download/v0.15.2/node_exporter-0.15.2.linux-amd64.tar.gz
$ tar xzvf node_exporter-0.15.2.linux-amd64.tar.gz
$ mv node_exporter-0.15.2.linux-amd64.tar.gz /usr/local/src/
$ mv node_exporter-0.15.2.linux-amd64 node_exporter
$ vim /etc/systemd/system/node_exporter.service
$ vim /etc/default/node_exporter
$ systemctl daemon-reload
$ systemctl enable node_exporter.service
@saitoxu
saitoxu / index.ios.js
Last active July 4, 2018 05:35
2017-09-30
import React, { Component } from 'react'
import {
ART,
AppRegistry,
StyleSheet,
View,
Text,
Dimensions,
Button
} from 'react-native'
@saitoxu
saitoxu / WebViewSample.js
Last active August 6, 2017 03:24
2017-08-06
// 外部ブラウザで開く例
import React, { Component } from 'react'
import { Alert, Linking, WebView } from 'react-native'
const ATS_ERROR_CODE = -1022
export default class WebViewSample extends Component {
constructor(props) {
super(props)
@saitoxu
saitoxu / AppDelegate.m
Created July 29, 2017 03:59
2017-07-29
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
@saitoxu
saitoxu / Client.js
Created May 9, 2017 08:27
2017-05-09
onSubmit(e) {
e.preventDefault()
const fd = new FormData()
fd.append('user[name]', this.state.name)
fd.append('user[email]', this.state.email)
fetch('http://example.com/users', {
method: 'POST',
body: fd
}).then(response =>
response.json()
@saitoxu
saitoxu / AsyncApp.js
Last active April 16, 2017 06:10
2017-04-16
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { fetchReposIfNeeded } from '../actions'
import Form from '../components/Form'
import Repos from '../components/Repos'
class AsyncApp extends Component {
constructor(props) {
super(props)
this.handleSubmit = this.handleSubmit.bind(this)
@saitoxu
saitoxu / Frame.js
Last active April 5, 2017 07:42
2017-04-05
import React, { Component } from 'react'
export default class Frame extends Component {
componentDidMount() {
const appearin = this.props.appearIn
const roomName = this.props.match.params.roomName
appearin.addRoomToElementById("appearin-frame", roomName)
}
render() {
@saitoxu
saitoxu / App.js
Last active April 2, 2017 09:12
2017-04-02
import React, { Component } from 'react'
import { Link, Route, Switch } from 'react-router-dom'
import Form from './Form'
import Todo from './Todo'
import TodoList from './TodoList'
const Top = () => (
<div>Top</div>
)
@saitoxu
saitoxu / App.js
Last active March 30, 2017 01:29
2017-03-30
import React, { Component } from 'react';
import Form from './Form';
import TodoList from './TodoList';
export default class App extends Component {
constructor() {
super();
this.state = {
todos: []
};
@saitoxu
saitoxu / Board.js
Last active March 26, 2017 04:59
2017-03-26
import React, { Component } from 'react';
import Square from './Square';
class Board extends Component {
renderSquare(i) {
return <Square key={i}
value={this.props.squares[i].value}
onClick={() => this.props.onClick(i)}
highlighted={this.props.squares[i].highlighted} />;
}