Skip to content

Instantly share code, notes, and snippets.

View KentaKomai's full-sized avatar
🏠
Working from home

kken KentaKomai

🏠
Working from home
  • vitte
  • Tokyo, Japan
View GitHub Profile
#include<iostream>
#include<cmath>
using namespace std;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
/*
* forループで配列内の最大値を返す
*/
@KentaKomai
KentaKomai / gist:5925054
Created July 4, 2013 05:11
railsで指定したバージョンでアプリケーションを作成する

新規作成

  1. gemfileの作成
  2. $ bundle install --path vendor/bundle
  3. $ bundle exec rails new example --skip-bundle

セットアップ

  1. $ bundle install --path vendor/bundle
  2. $ bundle exec rails server
hogehoge
git-vim test
#include <iostream>
#include <algorithm>
using namespace std;
struct listNode {
int data;
listNode * next;
}; typedef listNode * listPtr;
@KentaKomai
KentaKomai / gist:5974506
Created July 11, 2013 10:56
jqueryUI + AngularJS Own directive
App.directive(directiveName, function($document, $parse) {
return {
restrict : 'A',
link : function($scope, $element, $attr) {
var fn = $parse($attr[e.name]);
$element.on(jQueryUIEventName, function(event, ui) {
$scope.$apply(function(){
//processing of any
#include <iostream>
#include <algorithm>
using namespace std;
struct ListNode {
int data;
ListNode * next;
}; typedef ListNode * ListPtr;
@KentaKomai
KentaKomai / gist:6129542
Created August 1, 2013 08:30
ruby warrior level 6
class Player
def play_turn(warrior)
# initialize health and map
if @health == nil then
@health = warrior.health
end
if @map == nil then
@map = {0 => 'E'}
@map_index = 0
@KentaKomai
KentaKomai / gist:6129744
Created August 1, 2013 09:07
ruby warrior level 9
class Player
def play_turn(warrior)
# initialize health and map
if @health == nil then
@health = warrior.health
end
if @map == nil then
@map = {0 => 'E'}
@map_index = 0
@KentaKomai
KentaKomai / gist:6129801
Created August 1, 2013 09:18
ruby warrior level 1
class Player
def play_turn(warrior)
warrior.walk!
end
end