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
| #!/bin/bash | |
| function do_backup(){ | |
| FICHERO_BACKUP=$1 | |
| # Do the backup | |
| $MYSQL_PATH/mysqldump -p"$password" \ | |
| --add-drop-table \ | |
| -h "$hostname" \ | |
| -u "$username" \ | |
| "$database" \ |
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
| // def writer = new FileWriter('markup.html') | |
| def writer = new StringWriter() | |
| def html = new groovy.xml.MarkupBuilder(writer) | |
| html.html { | |
| head { title 'Constructed by MarkupBuilder' } | |
| body { | |
| h1 'What can I do with MarkupBuilder?' | |
| form (action:'whatever') { |
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 java.util.Date | |
| import java.text.SimpleDateFormat | |
| String myDate= '2011-01-20T13:51:24.63Z' | |
| Date dtTmp = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss").parse( myDate); | |
| println dtTmp.toString() |
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
| // def writer = new FileWriter('markup.html') | |
| def writer = new StringWriter() | |
| def html = new groovy.xml.MarkupBuilder(writer) | |
| html.html { | |
| head { title 'Constructed by MarkupBuilder' } | |
| body { | |
| h1 'What can I do with MarkupBuilder?' | |
| form (action:'whatever') { | |
| for (line in ['Produce HTML','Produce XML','Have some fun']) |
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 org.apache.commons.lang.StringEscapeUtils | |
| // Alternate way to import | |
| this.class.classLoader.rootLoader.addURL(new File("/usr/local/java/grails-1.0/lib/commons-lang-2.1.jar").toURL()) | |
| xml = ''' | |
| <module id="id" version="0.0.1" package="package"> </module> | |
| ''' |
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 org.restlet.data.MediaType; | |
| import org.restlet.resource.DomRepresentation; | |
| import org.w3c.dom.Document | |
| // Representation | |
| DomRepresentation representation = new DomRepresentation( MediaType.TEXT_XML) | |
| // Get the document root | |
| Document doc= representation.getDocument() |
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
| class MyClass{ | |
| def myname | |
| } | |
| class TestCase{ | |
| TestCase(){ } | |
| def testNonEmptyTask(){ | |
| def f = new MyClass() |
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
| data= '[ "mykey": "myValue" ]' | |
| map = Eval.me( data ) | |
| // map= {myKey=myValue} |
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
| wget --spider -r -l0 -np -k http://www.yoursite.com/ |
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 ellipsisId= 'ellipsis_test_element'; | |
| var ellipsisElement= null; | |
| function insertEllipsisElement(){ | |
| if( !ellipsisElement){ | |
| ellipsisElement= document.createElement( 'div'); | |
| ellipsisElement.id= ellipsisId; | |
| document.body.appendChild( ellipsisElement); | |
| } | |
| } | |