Skip to content

Instantly share code, notes, and snippets.

Avatar
🖥️
I may be slow to respond.

Vladimir Orany musketyr

🖥️
I may be slow to respond.
View GitHub Profile
View MET-523-generator.groovy
println """classification name: 'MET-523', {"""
3.times { modelNum ->
println """ model name: 'MET-523.M${modelNum + 1}', { """
5.times { dataElementNum ->
println """ dataElement name: 'MET-523.M${modelNum + 1}.DE${dataElementNum + 1}', { """
println """ valueDomain name: 'MET-523.M${modelNum + 1}.VD${dataElementNum + 1}', { """
println """ dataType name: 'MET-523.DT${dataElementNum + 1}'"""
println """ measurementUnit name: 'MET-523.MU${dataElementNum + 1}'"""
println """ }"""
println """ }"""
@musketyr
musketyr / deploy.sh
Created May 20, 2015
ModelCatalogue deploy script
View deploy.sh
#!/bin/bash
set -e
# backup
BKP_TIMESTAMP="$(date +"%Y%m%d_%H%M%S")"
mkdir -p ~/mc/bkp/$BKP_TIMESTAMP
cp /var/lib/tomcat7/webapps/ModelCatalogue.war ~/mc/bkp/$BKP_TIMESTAMP/ModelCatalogue.war
sudo service tomcat7 stop
@musketyr
musketyr / gaelyk-sample.groovy
Created Mar 25, 2011
How should be Gaelyk plugins defined in Gradle build
View gaelyk-sample.groovy
// since the missing task arguments, the plugins will be defined in gaelyk block
apply plugin: 'gaelyk'
gaelyk {
// during each build will be checked this plugins against installed and any missing
// will be installed automatically
apply git: 'https://github.com/bmuschko/gaelyk-datastore-viewer-plugin.git'
apply zip: 'path/to/zipped/plugin.zip'
// if I delete or comment some installed plugin, it will be uninstalled automatically
@musketyr
musketyr / build.gradle
Created Apr 1, 2011
How could be simply passed arguments to the Gradle build
View build.gradle
task args
args.map = [:]
tasks.addRule("Pattern: <property>=<value>: Passes arguments to the scripts") { String taskName ->
def match = taskName =~ /(.*?)=(.*?$)/
if(match){
args.map[match[0][1]] = match[0][2]
task(taskName) << {
println "Used to pass value ${match[0][2]} to args.map.${match[0][1]}"
}
View gaelyk.dsld
import java.util.concurrent.Future;
// Things to discuss
// # are there any ways how to promote dsls to templates like gtpl?
// # are there any ways to check operators like left shift?
// # is there any way to handle generics like Key<Entity>?
// # how to handle closure parameters?
class EnvDescriptor {
String name
View categoryExplorer.groovy
import java.lang.reflect.Method;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import groovyx.gaelyk.GaelykCategory;
// scaffolds DSLD for category class to the system console
// setup
@musketyr
musketyr / gist:980550
Created May 19, 2011
image manipulations language
View gist:980550
(enclosingCallName("transform") &
inClosure() &
enclosingCallDeclaringType('com.google.appengine.api.images.Image')).accept{
provider = 'Gaelyk'
method name: 'feeling',
type: 'com.google.appengine.api.images.Image',
params: [lucky: boolean],
doc: 'Applies the "I\'m feeling lucky" transformation.'
@musketyr
musketyr / gist:980544
Created May 19, 2011
shortcutFor pointcut
View gist:980544
def shortcutFor = { type ->
currentType(type) &
enclosingScript(sourceFolderOfCurrentType('war/WEB-INF/groovy'))
}
shortcutFor('com.google.appengine.api.images.Image').accept {
provider = 'Gaelyk'
// contributions
}
@musketyr
musketyr / gist:980549
Created May 19, 2011
groovlets contributions
View gist:980549
(sourceFolderOfCurrentType('war/WEB-INF/groovy') & enclosingScript()).accept {
provider = 'Gaelyk Groovlet'
property name: 'datastore',
type: 'com.google.appengine.api.datastore.DatastoreService'
// many more here
method name: 'forward',
type: 'void',
params: [path: 'java.lang.String'],
View GSQL.groovy
class GSQL {
static SelectBuilder select(Object... what){
SelectBuilder builder = []
if(All.ALL in what){
builder.all = true
} else {
builder.columns = what
}
builder
}