Skip to content

Instantly share code, notes, and snippets.

View yamadayuki's full-sized avatar
💭
🍖

Yamada Yuki yamadayuki

💭
🍖
View GitHub Profile
@yamadayuki
yamadayuki / .babelrc
Last active September 14, 2017 14:34
Babel6でMochaとChaiを使ったテストを書く ref: http://qiita.com/yamadayuki/items/9885c9e126648cd8c5e3
{
"presets": ["es2015"]
}
@yamadayuki
yamadayuki / SampleComponent.js
Created June 19, 2016 14:58
Use keyframes property with React using inline style
import React from 'react';
import injectStyle from './path/to/injectStyle';
export default class SampleComponent extends React.Component {
constructor(props) {
super(props);
const keyframesStyle = `
@-webkit-keyframes pulse {
0% { background-color: #fecd6d; }
@yamadayuki
yamadayuki / insertion_sort.js
Last active December 8, 2016 17:49
Insertion Sort
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A
// Test case
// 6
// 5 2 4 6 1 3
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
var n = +input.shift();
var nums = input.shift().split(' ').map(Number);
@yamadayuki
yamadayuki / greatest_common_divisor.js
Created December 8, 2016 17:57
Greatest Common Divisor
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_B
// Test Case
// 54 20 => 2
// 147 105 => 21
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(' ').map(Number);
function gcd(x, y) {
if (y === 0) {
@yamadayuki
yamadayuki / prime_numbers.js
Created December 8, 2016 18:21
Prime Numbers
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C
// Test Case
// 5
// 2
// 3
// 4
// 5
// 6
// => 3
@yamadayuki
yamadayuki / maximum_profit.js
Created December 8, 2016 18:45
Maximum Profit
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_D
// Test Case
// 6
// 2
// 3
// 1
// 3
// 4
// 3
@yamadayuki
yamadayuki / bubble_sort.js
Created December 8, 2016 18:55
Bubble Sort
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_A
// Test Case
// Input
// 6
// 5 2 4 6 1 3
// Output
// 1 2 3 4 5 6
// 9
@yamadayuki
yamadayuki / selection_sort.js
Created December 8, 2016 19:04
Selection Sort
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B
// Test Case
// Input
// 6
// 5 2 4 6 1 3
// Output
// 1 2 3 4 5 6
// 3
@yamadayuki
yamadayuki / stable_sort.js
Created December 8, 2016 19:29
Stable Sort
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_C
// Test Case
// Input
// 5
// H4 C9 S4 D2 C3
// Output
// D2 C3 H4 S4 C9
// Stable
@yamadayuki
yamadayuki / shell_sort.js
Created December 8, 2016 20:20
Shell Sort
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D
// Test Case
// Input
// 5
// 5
// 1
// 4
// 3
// 2