Skip to content

Instantly share code, notes, and snippets.

View masuhajime's full-sized avatar
🐽

masu1 masuhajime

🐽
View GitHub Profile
@masuhajime
masuhajime / .vimrc
Created July 30, 2014 03:09
.vimrc
set encoding=japan
set fileencodings=sjis,utf-8,iso-2022-jp,euc-jp
set nu
colorscheme darkblue
set expandtab
set tabstop=4
set shiftwidth=4
set nocompatible
set title
@masuhajime
masuhajime / gist:e7b8b4cab6c6037f1bbe
Created March 12, 2015 06:30
html中の<input type="radio"> をランダムに選択するBookMarklet
javascript:(function(){var url='//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js';if(!url.match(/\?/))url+='?t='+(new Date()).getTime();var d=document;var e=d.createElement('script');e.charset='utf-8';e.src=url;d.getElementsByTagName('head')[0].appendChild(e);function shuffle(t){for(var n,u,h=t.length;h;)u=Math.floor(Math.random()*h--),n=t[h],t[h]=t[u],t[u]=n}var inputs=[];$("input[type=radio]").each(function(){inputs.push($(this))}),shuffle(inputs);for(var j=0;j<inputs.length;j++)inputs[j].prop("checked",!0);})();
@masuhajime
masuhajime / gist:7534a12ccb1d717b5396
Created April 8, 2015 17:10
lambda地獄(どうすればよいのか)
// ランキング登録
this->addButton(Vec2(0, this->getBoundingBox().getMaxY()), "RegisterRank", [](Ref* ref, Widget::TouchEventType type){
if (type != Widget::TouchEventType::ENDED) {return;}
CCLOG("btn touched: Register Ranking");
auto scene = amoamo::common::scene::Ranking::createNameInput(
[](std::string inputText){
if (inputText.length() == 0) {
Director::getInstance()->getRunningScene()->addChild(amoamo::common::layer::Overlay::createDialogOk("名前を入力してね\n\(^o^)/"));
return;
}
int main(int argc, char** argv)
{
auto get_nums = [](){return rx::observable<>::from<int>(
1,2,3,4,5,6,7,8,9,10
);};
auto hello_str = [&](){return get_nums().map([](int n){
return std::to_string(n).c_str();
}).as_dynamic();};
@masuhajime
masuhajime / gist:2f14ebf6a117ac61662f
Last active August 29, 2015 14:18
tracのpropsを削除するBookMarklet
javascript:(function(){
var e = document.getElementsByClassName('props');
var num = e.length;
for (var i = 0; i < num; i++) {
e[0].remove();
}
})();
@masuhajime
masuhajime / gist:756cd6918a1f735dfd4e
Created April 11, 2015 08:08
fadeIN/Out rotation
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript">
function rotate(){
$('#catch1').fadeIn(500, function() {
$(this).fadeOut(500, function() {
$('#catch2').fadeIn(500, function() {
$(this).fadeOut(500, function() {
$('#catch3').fadeIn(500, function() {
$(this).fadeOut(500, function() {
$('#catch4').fadeIn(500, function() {
{
auto listener = larme::eventlistener::EventListenerTouchAction::create();
listener->onTouchesActionZoom = [this](float distance) {
this->cameraZoom += distance / 1000.0f;
// ここで distanceのmaxを設定したほうがいいかも・
};
listener->onTouchesActionPan = [this](Vec2 distance) {
this->cameraPosition -= distance / this->cameraZoom;
};