my .vimrc

やっぱり vim 使えたほうが 便利かなと思い 数ヶ月前から 使い始めました
最初に比べれば だいぶ慣れてきたかな

自分が 他のPC で使いたいときがあるので 自分の copy 用に up
慣れるまでは mac の キーバインドに寄せておいて
習熟に合わせて vim 本来の機能を復活させていく系の途中段階 という感じのものです

“my .vimrc” の続きを読む

apache conf memo

<Directory "/Users/kamui/Sites">
  AddType text/html .shtml .html
  AddHandler server-parsed .shtml .html
  Options Indexes MultiViews FollowSymlinks Includes
  AllowOverride all
  Require all granted
</Directory>
Sub main()
  Debug.Print "main start"

  ' Dim book
  ' book = SpreadsheetApp.getActiveSpreadsheet()
  ' Dim sheets
  ' sheets = book.getSheets()

  Dim s_row, s_col
  s_row = 3
  s_col = 1

  Dim sheet
  Set sheet = ActiveSheet

  Call tbl_clr(sheet, s_row)
  
  Dim t_lvl_num() As Integer
  
  Call lvl_num(sheet, t_lvl_num)
  ' t_lvl_num = Array(3, 2, 2, 4)
  Debug.Print "t_lvl_num", t_lvl_num(0), t_lvl_num(1), t_lvl_num(2)
  
  Call fct__Y_rcrsv(sheet, s_row, s_col, t_lvl_num)

End Sub

Function lvl_num(sheet, p_lvl_num As Variant) As Long
  Debug.Print "lvl_num start"

  Dim rng_tmp
  rng_tmp = sheet.Range("A1:C1").Value
  
  Dim j
  j = 0
  For i = 1 To 3
    
    If IsNumeric(rng_tmp(1, i)) = True Then
   
      ReDim Preserve p_lvl_num(j)
      p_lvl_num(j) = rng_tmp(1, i)
      Debug.Print "p_lvl_num(j)", p_lvl_num(j)
      
      j = j + 1
    End If
  Next i
  
End Function

Sub fct__Y_rcrsv(sheet, s_row, s_col, lvl_num)
  Debug.Print "fct__Y_rcrsv start"

  Dim lvl_num_undr_lngth
  lvl_num_undr_lngth = 0
  
  Dim lvl_num_undr() As Integer
  
  Dim lvl_num_lngth
  lvl_num_lngth = UBound(lvl_num) + 1
  Debug.Print "lvl_num_lngth", lvl_num_lngth
  
  If lvl_num_lngth >= 2 Then
  
    lvl_num_undr_lngth = lvl_num_lngth - 1
    Debug.Print "lvl_num_undr_lngth", lvl_num_undr_lngth
    
    ReDim lvl_num_undr(lvl_num_undr_lngth - 1)
   
    For i = 1 To UBound(lvl_num)
      lvl_num_undr(i - 1) = lvl_num(i)
    Next i
  'Debug.Print "lvl_num_undr", lvl_num_undr(0)
  End If

  Dim undr_col
  undr_col = 1
  
  If lvl_num_undr_lngth >= 1 Then
    For i = 0 To lvl_num_undr_lngth - 1
  
      undr_col = undr_col * lvl_num_undr(i)
      Debug.Print "i:", i, undr_col
    Next i
  End If
  Debug.Print "undr_col", undr_col

  Call fct_new__Y(sheet, s_row, s_col, lvl_num(0), undr_col)

  If undr_col <= 1 Then
    Exit Sub
  End If

  For i = 0 To lvl_num(0) - 1

    Call fct__Y_rcrsv(sheet, s_row + lvl_num(0), s_col + i * undr_col, lvl_num_undr)
  Next i
  
  Debug.Print "fct__Y_rcrsv end"
End Sub

Sub fct_new__Y(sheet, s_row, s_col, lvl_num, undr_col)
  Debug.Print "fct_new__Y start, lvl_num", lvl_num

  Const Y = "Y"
  Const N = "N"

  For i = 0 To lvl_num - 1

    Call cel_rng__(sheet, s_row + i, s_col + i * undr_col, 1, undr_col, Y)
  Next i
End Sub

Sub cel_rng__(sheet, s_row, s_col, row_num, col_num, val)
  Debug.Print "cel_rng__ start"
  Debug.Print s_row, s_col, row_num, col_num

  Dim cel_s
  Set cel_s = sheet.Cells(s_row, s_col)
  Dim cel_e
  Set cel_e = sheet.Cells(s_row + row_num - 1, s_col + col_num - 1)
  
  sheet.Range(cel_s, cel_e).Value = val
  
  Debug.Print "cel_rng__ end"
End Sub

Sub cel__(sheet, row, col, val)

  sheet.Range(row, col).Value = val
End Sub

Sub tbl_clr(sheet, s_row)
  Debug.Print "tbl_clr start"

  Dim cel_s
  Set cel_s = sheet.Cells(s_row, 1)
  Dim cel_e
  Set cel_e = ActiveCell.SpecialCells(xlLastCell)
  Debug.Print "cel_e"
  Debug.Print cel_e
  
  sheet.Range(cel_s, cel_e).ClearContents
  
  Debug.Print "tbl_clr end"
End Sub

'
' utl
'

Function ar_push(ar As Variant, addValue As Variant) As Long

    '// 引数が配列でない場合
    If IsArray(ar) = False Then
        '// 処理せず抜ける
        Exit Function
    End If
    
    '// 配列要素数を取得
    Dim iSize   As Long         '// 配列サイズ
    
    '// 配列サイズを拡張後のサイズで取得
    iSize = UBound(ar) + 1
    
    '// 拡張
    ReDim Preserve ar(iSize)
    
    Dim i       As Long         '// ループカウンタ
    
    '// オブジェクト型変数の場合
    If IsObject(ar(0)) = True Then
        '// 終端に現在ループ値を設定
        Set ar(iSize) = addValue
    '// プリミティブ型変数(IntegerやStringなど)の場合
    Else
        '// 終端に現在ループ値を設定
        ar(iSize) = addValue
    End If
    
    '// 要素数を返却
    ar_push = UBound(ar)
End Function