Skip to content

Instantly share code, notes, and snippets.

View bleis-tift's full-sized avatar

bleis-tift bleis-tift

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
#pragma warning disable 0414
namespace Enumに柔軟な拡張を追加する試み
{
nnoremap <Space>gn :<C-u>w<CR>:Git now<CR>
nnoremap <Space>gN :<C-u>w<CR>:Git now --all<CR>
@bleis-tift
bleis-tift / Program.fs
Created May 3, 2011 03:19
F#で文字列をeval
open Microsoft.FSharp.Compiler.CodeDom
open System.Reflection
open System.CodeDom.Compiler
type EvalResult<'a> =
| CompileError of string seq
| RuntimeError of exn
| Success of 'a
let eval args expr =
// Microsoft.CSharpを参照に追加すること
open System.Reflection
open System.Runtime.CompilerServices
open Microsoft.FSharp.Reflection
open Microsoft.CSharp.RuntimeBinder
let convert (inp:obj) : 'res =
inp |> unbox
Option Explicit
Private xSource As Variant
Private xLbRow As Long
Private xUbRow As Long
Private xLbCol As Long
Private xUbCol As Long
Private xIndexes As Variant
Public carry As Boolean
Function AnsCount(range, trg)
Dim res()
res = EnumCombi(range, trg)
AnsCount = UBound(res)
End Function
Function NextCells(range, crnt)
Dim min
@bleis-tift
bleis-tift / git-now
Created October 29, 2011 13:05 — forked from mzp/git-now
git-now
#!/bin/sh
PREFIX="from now"
MESSAGE="[${PREFIX}] `date +\"%Y/%m/%d %T\"`"
get_amend() {
if [ -z `git log --pretty=oneline -1 | cut -d " " -f 2- | grep "^\[${PREFIX}]"` ]
then
return 1
fi

=========== Gitについて

リポジトリ

データを貯めておく所。 ソースの管理をファイルサーバでやっているなら共有フォルダ、SVNでやっているならリポジトリ、Gitもリポジトリ。 SVNのリポジトリとGitのリポジトリが異なる点は、直接の操作対象となるリポジトリが手元にある(Git)か、リモートにある(SVN)か。

@bleis-tift
bleis-tift / gist:1496402
Created December 19, 2011 09:59
桜花あどべんとかれんだぁ19日目

おーかたんとぼく

桜花あどべんとかれんだぁ19日目のエントリです。

であい

おーかたんと初めて会ったのは、高専の演習室でした。 おーかたんは幼女なのにすでに高専の2年生をやっていたようです。

@bleis-tift
bleis-tift / gist:1698305
Created January 29, 2012 11:08
obj list型のxsをtのlistにするコード(tはSystem.Typeオブジェクト)
open Microsoft.FSharp.Reflection
let listType = typedefof<list<_>>.MakeGenericType([| t |])
let cases = FSharpType.GetUnionCases(listType)
let nil, cons = cases.[0], cases.[1]
let lst = FSharpValue.MakeUnion(nil, [||])
let consR x xs =
ref (FSharpValue.MakeUnion(cons, [| x; !xs |]))
!(List.foldBack consR xs (ref lst)) |> unbox