Skip to content

Instantly share code, notes, and snippets.

(ns sekigahara-shogi-mobile.logic)
(defn- moves [koma]
(case koma
:hu [{:x 0 :y -1 :any? false}]
:ky [{:x 0 :y -1 :any? true }]
:ke [{:x -1 :y -2 :any? false}
{:x 1 :y -2 :any? false}]
:gi [
{:x -1 :y -1 :any? false}
cljs.user=> (update-in (vec (filter #(> % 0) [9 8 0 9 8 7 1])) [2] inc)
[9 8 10 8 7 1]
cljs.user=> (update-in [9 8 0 9 8 7 1] [2] inc)
[9 8 1 9 8 7 1]
cljs.user=> (update-in (filter #(> % 0) [9 8 0 9 8 7 1]) [2] inc)
No protocol method IAssociative.-assoc defined for type cljs.core/LazySeq: (9 8 9 8 7 1)
Object.cljs.core.missing_protocol (NO_SOURCE_FILE <embedded>:179:274)
Object.cljs.core._assoc (NO_SOURCE_FILE <embedded>:275:436)
Function.cljs.core.assoc.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:490:88)
Function.cljs.core.update_in.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1045:310)
(defn- ninize [list-]
(take (count list-) (repeat 9)))
(defn- numberize [list-]
(map #(read-string (str %)) list-))
(defn- asc-list [num-str]
(defn- iter [[f s & r] result]
(cond (nil? f) (flatten result)
(nil? s) (flatten (conj result f))
ymd = Time.now.strftime("%Y%m%d")
Dir.glob("*").sort.each_with_index do |file, idx|
File.rename(file, ymd + format("%06d", idx) + file[14, file.length])
end
#!/usr/bin/ruby
level1 = []
level2 = []
done = 0
sum = STDIN.gets.to_i
num = STDIN.gets
while a = STDIN.gets
a = a.to_i
level2.each{|x| done += 1 if x == a }
//
// UIView+adjustText.m
//
// Created by J_ogawa on 2014/04/04.
// Copyright (c) 2014年 J_ogawa. All rights reserved.
//
#import "UIView+adjustTextLabel.h"
@implementation UIView (adjustTextLabel)
@J-ogawa
J-ogawa / ggr
Created April 3, 2014 15:52
google search each arg keywords. example: pod list | grep -i web | awk '{print $1}' | xargs ggr
#!/bin/bash
if [ $# -gt 10 ]
then
echo -n "ggr $# possibilities? (y or n)"
read ans </dev/tty
if [ $ans != 'y' ]
then
exit 0
fi
@J-ogawa
J-ogawa / UIView+adjustSubView.m
Created April 1, 2014 17:33
UIView addSubView nice position.
//
// UIView+adjustSubView.m
//
// Created by J_ogawa on 2014/01/31.
// Copyright (c) 2014年 J_ogawa. All rights reserved.
//
#import "UIView+adjustSubView.h"
@implementation UIView (adjustSubView)
//
// UIView+adjustSubView.h
//
// Created by J_ogawa on 2014/01/31.
// Copyright (c) 2014年 J_ogawa. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef enum {
@J-ogawa
J-ogawa / UIScrollView+addView.m
Last active August 29, 2015 13:57
add content to UIScrollView, auto calc scrollView's content size.
//
// UIScrollView+addView.m
//
// Created by J_ogawa on 2013/12/24.
// Copyright (c) 2013年 J_ogawa. All rights reserved.
//
#import "UIScrollView+addView.h"
@implementation UIScrollView (addView)