View deepMapToMap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deepMapToMap(map,tmpMap,suffixkey){ | |
if(suffixkey==null) suffixkey = ''; | |
if(tmpMap==null) tmpMap = {}; | |
for(var key in map){ | |
if(map[key].constructor.name==='Object'){ | |
deepMapToMap(map[key],tmpMap,suffixkey+key+'.'); | |
}else{ | |
tmpMap[suffixkey+key] = map[key]; | |
} | |
} |
View read_ods.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.jopendocument:jOpenDocument:latest.release') | |
import org.jopendocument.dom.spreadsheet.* | |
def odsPath = '/Users/kanemu/Desktop/画像整理.ods' | |
def odsFile = new File(odsPath) | |
def odsDoc = SpreadSheet.createFromFile(odsFile) | |
def odsSheetLastIndex = odsDoc.getSheetCount()-1 | |
MutableCell cell = null |
View tasu.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groovy https://gist.github.com/kanemu/6557373/raw/tasu.groovy |
View gvm-glstart.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: | |
# This script must be placed in the ~/.gvm/ext folder | |
function gvm_glstart { | |
ARGS=$@ | |
EXECUTABLE="grails" | |
if [ -f application.properties ]; then | |
G_VERSION=$( cat application.properties | grep "app.grails.version=" | sed -e "s/^.*=//" | tr -d '\r\n ' ) |
View ultraEscapeJson.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.codehaus.jackson.map.ObjectMapper | |
import org.codehaus.jackson.io.CharacterEscapes | |
import org.codehaus.jackson.SerializableString | |
import org.codehaus.jackson.JsonGenerator.Feature | |
@Grab(group='org.codehaus.jackson', module='jackson-mapper-lgpl', version='1.9.9') | |
public class CustomCharacterEscapes extends CharacterEscapes { | |
private final int[] _asciiEscapes; |
View bridgetalktest.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target " Illustrator" | |
//InD風Boundsに変換するfunction | |
forIndBounds=function(bounds){ | |
var h=app.activeDocument.height; | |
var ary=[ | |
h-bounds[1], | |
bounds[0], | |
h-bounds[3], | |
bounds[2] |
View json.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.codehaus.jackson.map.ObjectMapper | |
import org.codehaus.jackson.JsonParser.Feature | |
@Grab(group='org.codehaus.jackson', module='jackson-mapper-lgpl', version='1.6.0') | |
def mapper = new ObjectMapper() | |
//読み込み | |
String jsonText = """{ | |
"名前" : { "first" : "一朗", "last" : "鈴木" }, | |
"打率" : ".315", |
View untag.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc=app.activeDocument; | |
var items = doc.allPageItems; | |
for(var i=items.length-1;i>=0;i--){ | |
var item = items[i]; | |
if(item.associatedXMLElement){ | |
items[i].associatedXMLElement.untag(); | |
} | |
} |
View gitclonetmbundle.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('com.madgag:org.eclipse.jgit:1.0.99.0.7-UNOFFICIAL-ROBERTO-RELEASE') | |
import org.eclipse.jgit.api.Git | |
String userHome = System.getProperty("user.home") | |
Git.cloneRepository().setURI("git://github.com/kanemu/extendscript.tmbundle.git") | |
.setDirectory(new File("${userHome}/Library/Application Support/TextMate/Bundles/extendscript.tmbundle")) | |
.setBare(false) | |
.setCloneAllBranches(false) | |
.call() |
View map2map.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def map2Map(defaultMap,map){ | |
def resultMap = [:] | |
defaultMap.each{k,v -> | |
if(v instanceof Map){ | |
resultMap[k] = map2Map(v,map) | |
}else if(v instanceof Closure){ | |
resultMap[k] = map.with(v) | |
} | |
} | |
return resultMap |
NewerOlder