Skip to content

Instantly share code, notes, and snippets.

View yashihei's full-sized avatar

Ryuhei Kobayashi yashihei

View GitHub Profile
#include <iostream>
#include <vector>
#include <random>
class Board {
public:
Board() {
//容量確保
dat.resize(9);
for (int i = 0; i < 9; i++) {
@yashihei
yashihei / tekunyans.cs
Created July 18, 2014 05:38
てくなんず
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@yashihei
yashihei / wasureta.md
Last active August 29, 2015 14:19
Gitで何回も忘れてggってるコマンドを書いておく場所

このファイル管理したくないのにcommitしてしまったって時

  • .gitignoreに対象のファイルを追加
  • git rm --cached [filename]

リモートリポジトリにあるコミットを打ち消し

  • revertで歴史を書き換える
  • ブランチぶっ飛ばして入れ替えるなんてしない

過去のコミットを書き換え

  • git commit --amendで直前のコミットを書き換え
@yashihei
yashihei / main.cpp
Last active August 29, 2015 14:21
danmaku_generator
#include <Siv3D.hpp>
#include <deque>
using namespace std;
class Bullet {
public:
Bullet(Vec2 pos, Vec2 vec, Color color): pos(pos), vec(vec), color(color) {}
void move() {
pos += vec;
@yashihei
yashihei / memo.md
Created June 26, 2015 15:02
vectorでpush_backするとイテレータ破壊される

されるのだけど、これで困るのがイテレータを回してる時にpush_backしたいとき。

解決法としては

  1. 別のvectorコンテナに入れてあとでmergeする
  2. std::listを使う
@yashihei
yashihei / memo.md
Last active August 29, 2015 14:24
rbenv導入

Ubuntu14.10にて、以下の通りに。 2.2.0がコケる何で。とりあえず1.9.3を入れる。

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv install 1.9.3-p551
@yashihei
yashihei / text.md
Last active December 2, 2015 23:15
C言語でのファイル分割の定石について

この文章では、C言語においてチーム制作では欠かすことが出来ないファイル分割について説明する。

まず前提として

プレイヤー、敵、弾などのオブジェクト毎に、敵に関する処理はenemy.cpp、プレイヤーはplayer.cppみたく、ファイルを分割する。

どのように分割すれば良いのか

例えば敵の処理を分割したい場合。

enemy.h

@yashihei
yashihei / actor.cpp
Last active December 20, 2015 16:33
class Actor {
public:
Actor() = default;
virtual ~Actor() = default;
virtual void update() = 0;
virtual void draw() = 0;
void kill() { enable = false; }
bool isEnabled() const { return enable; }
private:
@yashihei
yashihei / main.js
Last active December 22, 2015 14:08
/*
* ブロック崩し
* written by yashihei
*/
enchant();
//グローバル変数
var game = null;
//定数
#include <iostream>
using namespace std;
template <class T>
class Stack {
public:
static const int STACK_SIZE = 100;
Stack() {sp = 0;}
void push(const T&);