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 groovy.json.* | |
import static groovy.json.JsonOutput.toJson | |
String sampleJson = '{"url":"http://www.yahoo.co.jp"}' | |
def jsonMap = new JsonSlurper().parseText(sampleJson) | |
String sampleJson2 = toJson(jsonMap) | |
assert sampleJson2 != sampleJson | |
assert sampleJson2 == '{"url":"http:\\/\\/www.yahoo.co.jp"}' |
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
#targetengine "logging" | |
var timeStamp = function(d){ | |
var i,ary; | |
if(!d){ d = new Date() }; | |
ary = [ | |
d.getFullYear(),(d.getMonth()+1),d.getDate(), | |
d.getHours(),d.getMinutes(),d.getSeconds() | |
]; | |
for(i=0,len=ary.length;i<len;i++){ |
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 timeStamp = function(){ | |
var d,i,ary; | |
d = new Date(); | |
ary = [ | |
d.getFullYear(),(d.getMonth()+1),d.getDate(), | |
d.getHours(),d.getMinutes(),d.getSeconds() | |
]; | |
for(i=0,len=ary.length;i<len;i++){ | |
ary[i] = (ary[i]<10)? '0'+ary[i]:''+ary[i]; | |
}; |
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" | |
function mergedBounds(bns,nowBns){ | |
if(!bns){ | |
bns=nowBns; | |
}else{ | |
if(nowBns){ | |
if(bns[0]>nowBns[0])bns[0]=nowBns[0]; | |
if(bns[1]<nowBns[1])bns[1]=nowBns[1]; | |
if(bns[2]<nowBns[2])bns[2]=nowBns[2]; |
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 obj=app.activeDocument.selection[0]; | |
if(obj.hasOwnProperty('paths')){ | |
var path = obj.paths.firstItem().entirePath; | |
for(var i=0,len=path.length;i<len;i++){ | |
$.writeln(uneval(path[i])); | |
} | |
} |
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(){ | |
var docs = app.documents; | |
if(docs.length===0)return; | |
for(var i=0,len=docs.length;i<len;i++){ | |
var doc = docs[i]; | |
var docPath = doc.fullName.absoluteURI; | |
if(parseInt(app.version) > 6){ | |
var idmlFile = new File(docPath.split('.')[0]+'.idml'); | |
doc.exportFile(ExportFormat.INDESIGN_MARKUP,idmlFile); | |
}else{ |
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(group='nekohtml', module='nekohtml', version='1.9.6.2') | |
@Grab(group='org.jdom', module='jdom', version='1.1') | |
import org.cyberneko.html.HTMLConfiguration | |
import org.apache.xerces.parsers.DOMParser | |
import org.xml.sax.InputSource | |
import org.jdom.input.DOMBuilder | |
import org.jdom.Document | |
import org.jdom.Element | |
import org.jdom.filter.ElementFilter |
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
#!/bin/bash | |
sips -s format png -z 512 512 $1 --out iTunesArtwork | |
sips -s format png -z 57 57 $1 --out Icon.png | |
sips -s format png -z 114 114 $1 --out Icon@2x.png | |
sips -s format png -z 72 72 $1 --out Icon-72.png | |
sips -s format png -z 29 29 $1 --out Icon-Small.png | |
sips -s format png -z 50 50 $1 --out Icon-Small-50.png | |
sips -s format png -z 58 58 $1 --out Icon-Small@2x.png |
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
String str = 'Hello,1717です。' | |
str = str.replaceAll(/[\uff01-\uff5e]/){new String((char)(((int)it)-65248))} | |
assert str=='Hello,1717です。' |
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(){ | |
//選択範囲内の行にハイパーリンク先があるかどうか調べる | |
if(app.documents.length===0)return; | |
var doc = app.activeDocument; | |
if(doc.selection.length===0)return; | |
var paras = doc.selection[0].paragraphs; | |
if(paras){ | |
var destTexts = doc.hyperlinkTextDestinations; | |
var destParas = destTexts.everyItem().destinationText; | |
for(var d=destParas.length-1;d>-1;d--){ |