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.io.BufferedReader; | |
import java.io.DataOutputStream; | |
import java.io.InputStreamReader; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
import javax.net.ssl.HttpsURLConnection; | |
public class HttpURLConnectionExample { |
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
GrailsApplication app = ApplicationContextHolder.getGrailsApplication() | |
ConfigObject config = app.getConfig() | |
String variable = config.grails.variableNamefromConfig |
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
beans = { | |
applicationContextHolder(ApplicationContextHolder) { bean -> | |
bean.factoryMethod = 'getInstance' | |
} | |
} |
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.springframework.context.ApplicationContext | |
import org.springframework.context.ApplicationContextAware | |
import javax.servlet.ServletContext | |
import org.codehaus.groovy.grails.commons.GrailsApplication | |
import org.codehaus.groovy.grails.plugins.GrailsPluginManager | |
import org.springframework.context.ApplicationContext | |
import org.springframework.context.ApplicationContextAware | |
@Singleton |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<div id="link">http://pkashyap28.wordpress.com | |
</div> | |
<a href="javascript:void (0)" id="copy-btn">Copy To Clipboard</a> |
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
Properties props = new Properties(); | |
props.put("mail.smtp.host", "smtp.gmail.com"); | |
props.put("mail.smtp.socketFactory.port", "465"); | |
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); | |
props.put("mail.smtp.auth", "true"); | |
props.put("mail.smtp.port", "465"); | |
final String username = "" | |
final String password = "" | |
Session session = Session.getDefaultInstance(props, | |
new javax.mail.Authenticator() { |
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
Properties props = System.getProperties(); | |
props.setProperty("mail.store.protocol", "imaps"); | |
try { | |
Session session = Session.getInstance(props, null); | |
Store store = session.getStore("imaps"); | |
final String username = "" | |
final String password = "" | |
store.connect("imap.gmail.com", 993, username, password); | |
Folder inbox = store.getFolder("INBOX"); | |
inbox.open(Folder.READ_ONLY); |
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
if (typeof jQuery !== 'undefined') { | |
(function($) { | |
$('#spinner').ajaxStart(function() { | |
$(this).fadeIn(); | |
}).ajaxStop(function() { | |
$(this).fadeOut(); | |
}); | |
})(jQuery); | |
} |
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
<script> | |
var validNavigation = false; | |
function wireUpEvents() { | |
var dont_confirm_leave = 0; | |
var leave_message = "You sure you want to leave ?"; | |
function goodbye(e) { | |
if (!validNavigation) { | |
if (dont_confirm_leave !== 1) { |
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
<script type="text/javascript"> | |
window.history.forward(); | |
function noBack() { window.history.forward(); } | |
</script> | |
</head> | |
<body onload="noBack();" | |
onpageshow="if (event.persisted) noBack();" onunload=""> |