Skip to content

Instantly share code, notes, and snippets.

View harawata's full-sized avatar

Iwao AVE! harawata

View GitHub Profile
@harawata
harawata / SubstituteDirective.java
Created January 21, 2015 16:43
A custom Velocity directive for MyBatis to perform text substitution. Related to https://github.com/mybatis/mybatis-3/pull/331
/*
* Copyright 2009-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@harawata
harawata / ColumnAliasDirective.java
Created March 15, 2014 17:34
A custom Velocity directive for MyBatis to generate column aliases. Related to https://github.com/mybatis/mybatis-3/pull/136
/*
* Copyright 2014 MyBatis.org.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@harawata
harawata / EhBlockingCache.java
Last active December 31, 2015 01:48
A custom Cache implementation for MyBatis using BlockingCache.
package org.mybatis.caches.ehcache;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
@harawata
harawata / git-svn-relocate
Created October 9, 2013 03:05
A shell script to perform 'svn switch --relocate' in a git-svn repository. - does not require old repo to be accessible. - does not require any new commit in the new repo. Example usage: git-svn-relocate "http://oldhost.olddomain.org/" "https://newhost.newdomain.net/" Note: - You need an account for the new repository. - Backup the local repo (i…
#!/bin/sh
GIT_CONFIG=".git/config"
SVN_DIR=".git/svn"
OLD_URL=$1
NEW_URL=$2
if [ -z "$OLD_URL" -o -z "$NEW_URL" ]; then
echo "git-svn-relocate OLD_URL NEW_URL"