Skip to content

Instantly share code, notes, and snippets.

View adachic's full-sized avatar

Akinori ADACHI adachic

  • Individual
  • Shinjuku
View GitHub Profile
@adachic
adachic / aho.cpp
Created January 8, 2017 14:24
moveの使い出がある場面
//ticketIdが一致するチケットを探し、保存した配列から消す(std::move使わない版)
PathTicket *PathFindTicketStore::getAndRemoveById(int ticketId) {
PathTicket *_ticket = nullptr;
_mtx.lock();
for (auto ticket : *_ticketsVec) {
if (ticket->id == ticketId) {
_ticket = PathTicket::copyFrom(ticket);
delete(ticket);
ticket = nullptr;
break;
//経路を同期的に算出し、返す
cocos2d::Vector<MapPosition *> PathFinder::findPathSync(
MapPosition *start,
MapPosition *end,
const cocos2d::Map<std::string, SDGameParts *> &jungleGym,
bool unitIgnore) {
std::vector<int> *ans = new std::vector<int>();
{
//自分のエリア
std::string tag1 = SDMapNode::makeTag(start->m_x, start->m_y, start->m_z );
//
// EXViewController.m
// Experiment
//
// Created by adachic on 2013/07/17.
// Copyright (c) 2013年 adachic. All rights reserved.
//
#import "EXViewController.h"
#include <sys/time.h>
@adachic
adachic / gist:6021476
Last active December 19, 2015 21:39
NSMutableArrayとLinkedList速度比較
//
// EXViewController.m
// Experiment
//
// Created by adachic on 2013/07/17.
// Copyright (c) 2013年 adachic. All rights reserved.
//
#import "EXViewController.h"
#include <sys/time.h>
@adachic
adachic / GetTextTask.java
Created May 4, 2013 06:24
webapiをたたいてスピナーに反映するためAsyncTask
package com.regaria.ijt;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.util.Xml;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
@adachic
adachic / prob2_improved.hs
Created April 8, 2013 02:35
問題2改良型
{-
- Problem 2
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
- -}
@adachic
adachic / prob2.hs
Created April 8, 2013 02:19
問題2
{-
- Problem 2
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
- -}
@adachic
adachic / gist:4636609
Created January 25, 2013 18:15
cocos2dで解像度で注意したいこと。iPhone5レチナか、レチナ以外iPhoneで、画面に表示される領域が異なる。 レチナ:640x960、非レチナ:320x480 レチナ以外iPhoneに合わせるのであれば、以下のL3にNOを代入するコードをいれれば良い。
-(BOOL) enableRetinaDisplay:(BOOL)enabled
{
enabled = NO;
// Already enabled ?
if( enabled && __ccContentScaleFactor == 2 )
return YES;
// Already disabled
if( ! enabled && __ccContentScaleFactor == 1 )
@adachic
adachic / app.js
Created August 20, 2012 07:04
LINE 非公式 API を使ってログイン
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
return;
}
@adachic
adachic / app.js
Created August 20, 2012 07:04
LINE 非公式 API を使ってログイン
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
return;
}