This file contains hidden or 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
| @GrabConfig(systemClassLoader=true) | |
| @GrabResolver(name='monkproject', root='http://www.monkproject.org/maven2/') | |
| @Grab(group='org.tmatesoft.svnkit', module='svnkit', version='1.3.5') | |
| @Grab(group='org.tmatesoft.svnkit', module='svnkit-javahl', version='1.3.5') | |
| @Grab(group='org.monkproject', module='svnant', version='1.1.0-rc2') | |
| @Grab(group='org.monkproject', module='svnClientAdapter', version='1.1.0-rc2') | |
| def ant = new AntBuilder() | |
| ant.typedef(resource: 'org/tigris/subversion/svnant/svnantlib.xml') | |
| ant.svn(username: 'guest', password: 'password') { |
This file contains hidden or 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
| db.foo.remove(); | |
| var rnd = function() { | |
| return Math.floor(Math.random() * 1000 + 100).toString(); | |
| } | |
| var date1 = new Date(); | |
| for (var i=0; i<1000000; i++) { | |
| var row1 = {key: rnd(), value: 'data'+rnd()} | |
| db.foo.save(row1); | |
| } | |
| print(new Date().getTime()-date1.getTime()); |
This file contains hidden or 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.xml.MarkupBuilder | |
| def sb = new StringWriter() | |
| def html = new MarkupBuilder(sb) | |
| html.doubleQuotes = true | |
| html.expandEmptyElements = true | |
| html.omitEmptyAttributes = false | |
| html.omitNullAttributes = false | |
| html.html { |
This file contains hidden or 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
| -client | |
| -startup | |
| ../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar | |
| --launcher.library | |
| ../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.100.v20110502 | |
| -product | |
| org.eclipse.epp.package.java.product | |
| --launcher.defaultAction | |
| openFile | |
| -showsplash |
This file contains hidden or 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
| apply plugin: 'jetty' | |
| apply plugin: 'java' | |
| apply plugin: 'groovy' | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| providedRuntime 'org.mortbay.jetty:jetty-ajp:6.1.26' |
This file contains hidden or 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
| <filter> | |
| <filter-name>encodingFilter</filter-name> | |
| <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> | |
| <init-param> | |
| <param-name>encoding</param-name> | |
| <param-value>UTF-8</param-value> | |
| </init-param> | |
| <init-param> | |
| <param-name>forceEncoding</param-name> | |
| <param-value>true</param-value> |
This file contains hidden or 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 mongodb = require('mongodb'); | |
| var server = new mongodb.Server("127.0.0.1", 27017, {}); | |
| new mongodb.Db('test', server, {}).open(function (error, client) { | |
| if (error) throw error; | |
| var collection = new mongodb.Collection(client, 'test_collection'); | |
| collection.find({}, {limit:10}).toArray(function(err, docs) { | |
| console.dir(docs); | |
| }); | |
| }); |
This file contains hidden or 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
| \documentclass[12pt,a4paper]{article} | |
| \usepackage[cm-default]{fontspec} | |
| \usepackage{xunicode} | |
| \usepackage{xltxtra} | |
| \usepackage{fontspec} %設定字型 | |
| \usepackage[slantfont,boldfont]{xeCJK} | |
| %\usepackage{xeCJK} %中英文分開設定 | |
| \usepackage{color} | |
| \usepackage{xcolor} | |
| \usepackage{listings} |
This file contains hidden or 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
| @GrabConfig(systemClassLoader=true) | |
| @Grab(group='net.sourceforge.jtds', module='jtds', version='1.2.4') | |
| import groovy.sql.Sql | |
| sql = Sql.newInstance( 'jdbc:jtds:sqlserver://localhost/test', 'sa', | |
| 'sasasa', 'net.sourceforge.jtds.jdbc.Driver' ) | |
| //sql.eachRow( 'select * from test1' ) { println "$it.id -- ${it.rnd} --" } | |
| sql.execute('delete from test1'); |
This file contains hidden or 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 app = require('express').createServer(), | |
| mongoose = require('mongoose'), | |
| db = mongoose.connect('mongodb://localhost/test'); | |
| var renderAsJSON = function (res, obj) { | |
| res.contentType('application/json'); | |
| res.send(JSON.stringify(obj)); | |
| } |