I hereby claim:
- I am sagrawal31 on github.
- I am shagrawal (https://keybase.io/shagrawal) on keybase.
- I have a public key ASBdggAw-it7HVnymLwArRHY_FbcbMmbH6ikz2jt8RRh8Ao
To claim this, I am signing this object:
/** | |
* Must have copyright statement either of the company or of our client. | |
* Follow other files in the repository. | |
*/ | |
package com.wp.test // package declaration just after copyright statement | |
// One line space after package declaration | |
// Import statement must be organized. Use organize tool in GGTS | |
import java.text.DateFormat |
#!/usr/bin/env bash | |
set -e | |
# Handy script to auto use the Grails 3 version based on what is defined in the "gradle.properties". This script uses | |
# the Grails installed by the famous SDKMan so it will look the Grails installation at "~/.sdkman/candidates/grails" | |
# so only make sure the particular Grails version is installed using "sdk install grails <version>". | |
# | |
# The only thing to care about is that this script should be included first in the "PATH" before the | |
# ".sdkman/candidates/grails/current" is included. | |
# |
import groovy.io.FileType | |
File fooDirectory = new File("/some-path-to-the-parent-directory") | |
// Recurse only *.html file (for example) | |
def reportNamePattern = ~/.*\.html/ | |
fooDirectory.eachFileMatch(FileType.FILES, reportNamePattern) { File myFile -> | |
// Use myFile as you want | |
println myFile.name | |
} |
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: tomcat7 | |
# Required-Start: $network | |
# Required-Stop: $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start/Stop Tomcat server | |
### END INIT INFO |
I hereby claim:
To claim this, I am signing this object:
URL getFinalURL(String url) { | |
getFinalURL(new URL(url)) | |
} | |
URL getFinalURL(URL url) { | |
HttpURLConnection connection = (HttpURLConnection) url.openConnection() | |
connection.setInstanceFollowRedirects(false) | |
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36") | |
connection.addRequestProperty("Accept-Language", "en-US,en;q=0.8") | |
connection.addRequestProperty("Referer", "http://example.com/") |
import liquibase.statement.core.UpdateStatement | |
databaseChangeLog = { | |
// Some other changeSets | |
changeSet(author: "Shashank (generated)", id: "1381499382647-13") { | |
addColumn(tableName: "ufile") { | |
column(name: "file_group", type: "varchar(255)") { | |
constraints(nullable: "false") |
import liquibase.statement.core.InsertStatement | |
databaseChangeLog = { | |
changeSet(author: "Shashank Agrawal", id: "my-custom-unique-id-for-each-changeSet-11212013-1") { | |
grailsChange { | |
change { | |
def statements = [] |
import liquibase.statement.core.InsertStatement | |
databaseChangeLog = { | |
changeSet(author: "Shashank Agrawal", id: "my-custom-unique-id-for-each-changeSet-11212013-1") { | |
grailsChange { | |
change { | |
def statements = [] | |
// Iterating through each row in table. | |
sql.eachRow('select * from old_table_name') { | |
def insertStatement = new InsertStatement("my_database_name", "new_table_name") |
import liquibase.statement.core.* | |
import com.some.domain.Post | |
databaseChangeLog = { | |
// Auto generated change sets which adds column to the post table. | |
grailsChange { | |
change { | |
Post.list().each { postInstance -> | |
postInstance.dateCreated = new Date() | |
postInstance.lastUpdated = new Date() |