Skip to content

Instantly share code, notes, and snippets.

@quchie
quchie / jsbin.uMiwuGe.html
Created September 18, 2013 09:22
Ember JS 1.0 with DataTables.net
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.6/ember.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js"></script>
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<meta charset=utf-8 />
<title>JS Bin</title>
@quchie
quchie / writeXML.groovy
Created April 3, 2014 09:05
Grails write xml file to network folder in windows
import jcifs.smb.*
import groovy.xml.MarkupBuilder
import org.custommonkey.xmlunit.*
def writer = new StringWriter()
def xml = new MarkupBuilder(writer)
xml.records() {
car(name:'HSV Maloo', make:'Holden', year:2006) {
@quchie
quchie / SQL_QUERY_FOR_HOST.sql
Last active August 29, 2015 14:02
Transfer Data from Database to another database using groovy script.
--This is the Query for the Host DB
--TODO: Change This
SELECT * FROM TABLENAME
@quchie
quchie / Send Email.groovy
Last active November 27, 2022 23:19
Send email using groovy script
import javax.mail.*
import javax.mail.internet.*
/*
Get Any JAVAMAIL Dependency
===============================
Download JAVAMAIL dependency that you need.
download JAVAMAIL at : https://maven.java.net/content/repositories/releases/com/sun/mail/javax.mail/1.5.2/javax.mail-1.5.2.jar
To install, copy & paste the *.jar to installed Groovy lib directory:
eg: C:\Program Files (x86)\Groovy\Groovy-2.1.1\lib
@quchie
quchie / public_key_windows.md
Last active August 30, 2016 16:07
Fix "Permission denied (publickey)" for windows

#How to setup SSH with online repository for WINDOWS only!

##Generate RSA Private key ssh-keygen -t rsa -C "[email protected]"

Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa): C:\Users\[profile]\.ssh\id_rsa
Enter passphrase (empty for no passphrase): [Type password or leave it empty and press enter]
@quchie
quchie / configMerge.groovy
Created October 26, 2016 07:22
Merge properties files with grails config in runtime
//Merges Properties file with config grails
Properties properties = new Properties()
//Lets say we have file in web-app/settings/setting.properties folder
File propertiesFile = grailsApplication.mainContext.getResource("settings/settings.properties").file
propertiesFile.withInputStream {
properties.load(it)
}
ConfigSlurper cs = new ConfigSlurper()
ConfigObject co = cs.parse(properties)
//.gitignore content
*.iws
*Db.properties
*Db.script
.settings
.classpath
.project
.idea
eclipse
stacktrace.log
@quchie
quchie / PrintToPrinterDirectWithJasper.groovy
Created November 18, 2016 07:02
Jasper Report print directly to physical printer (Jasper report 6.3.x API)
import net.sf.jasperreports.engine.data.JRXmlDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperPrintManager;
import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory;
import java.awt.print.PrinterJob;
@quchie
quchie / JasperXMLPrint.groovy
Created November 18, 2016 07:48
Jasper print with XML datasource (API 6.x.x)
//Forget about XML datasource, somehow it wont work... :( just need to pass xml in parameters to make it work..
//Lets say we have strings of XML or XML file or whatever in xml
String xmlDoc = '''<tag>PMHGK5860HD301330</tag>'''
Map parameters = new HashMap();
parameters.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, xmlDoc);
parameters.put("chasisno", chassisno);
parameters.put("imgFolderPath", path);
@quchie
quchie / How_to_deploy.md
Last active June 14, 2018 00:37
Grails 3 Deployment as a service and fat jar

Add to build.gradle (!IMPORTANT, add probably at the end of the file, after 'apply'):

springBoot {
    // Enable the creation of a fully
    // executable archive file.
    executable = true
}