Skip to content

Instantly share code, notes, and snippets.

View masaru-b-cl's full-sized avatar

TAKANO Sho / @masaru_b_cl masaru-b-cl

View GitHub Profile
using System;
using System.Data;
using System.Data.Common;
using Unmanaged = Oracle.DataAccess.Client;
using Managed = Oracle.ManagedDataAccess.Client;
namespace Continuo.Data.Oracle
{
@masaru-b-cl
masaru-b-cl / git-archive-diff
Last active August 29, 2015 14:15
git-archive-diff | コミット間で差分のあるファイルをzipでエクスポートする ( inspired by gitで差分ファイルを抽出する - Qiita http://qiita.com/kaminaly/items/28f9cb4e680deb700833 )
#!/bin/sh
function usage() {
echo "usage: git archive-diff [-o <zip-file-path>]"
echo "usage: git archive-diff <commit> [-o <zip-file-path>]"
echo "usage: git archive-diff <commit> <commit> [-o <zip-file-path>]"
exit 1
}
OUTPUT_FILE="archive.zip"
@masaru-b-cl
masaru-b-cl / git-doskoi
Created January 30, 2015 09:05
git-dosukoi ( refs. git でどすこいする方法 - Qiita http://qiita.com/NPoi/items/739dee62e0e5f0c5837c )
#!/bin/sh
REMOTE=${1:-"origin"}
git push ${REMOTE} `git rev-parse --abbrev-ref HEAD`
@masaru-b-cl
masaru-b-cl / pre-svn-dcommit
Created December 5, 2014 06:40
master以外でgit svn dcommitできないようにするフックスクリプト(https://github.com/rkitover/git-svn-hooks を使用する)
#!/bin/sh
WORKING_BRANCH=`git branch -l | grep "*" | cut -d " " -f 2`
if [ $WORKING_BRANCH != "master" ]
then
echo "WARNING: curret branch is NOT \"master\""
exit 1
fi
@masaru-b-cl
masaru-b-cl / BufferWithPredicate.cs
Last active August 29, 2015 14:07
条件に合致するものを区間ごとにまとめて返す
using System;
using System.Linq;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace BufferWithPredicate
{
public static class EnumerableExtensions
{
@masaru-b-cl
masaru-b-cl / UnitTest1.cs
Created September 10, 2014 07:10
好きな項目でMax/Minするケース
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;
namespace UnitTestProject2
{
class Person : IComparable<Person>
{
public int Age { get; set; }
@masaru-b-cl
masaru-b-cl / log.txt
Created August 5, 2014 16:55
タブ区切りのログ例
2014-08-06 01:52:13.8583 Info field1 field2 "改行や
タブ文字 を含む項目"
@masaru-b-cl
masaru-b-cl / App.config
Created August 5, 2014 16:52
NLogでタブ区切りのログを出力するための構成ファイル
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/log.txt" encoding="UTF-8">
<!-- タブ区切りのレイアウト -->
@masaru-b-cl
masaru-b-cl / Program.cs
Created August 5, 2014 16:42
タブ区切りのログを出力する
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var logger = NLog.LogManager.GetCurrentClassLogger();
@masaru-b-cl
masaru-b-cl / test.html
Created July 24, 2014 04:07
無名関数で外部ブロックの変数の操作
<script type="text/javascript">
var a = 1;
var f = function() {
a++;
}
alert(a); // 1
f();