Skip to content

Instantly share code, notes, and snippets.

View prabhatkashyap's full-sized avatar

Prabhat Kashyap prabhatkashyap

  • Nexthoughts Software Technology Pvt. Ltd.
  • Noida
View GitHub Profile
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 {
GrailsApplication app = ApplicationContextHolder.getGrailsApplication()
ConfigObject config = app.getConfig()
String variable = config.grails.variableNamefromConfig
beans = {
applicationContextHolder(ApplicationContextHolder) { bean ->
bean.factoryMethod = 'getInstance'
}
}
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
<!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>
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() {
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);
if (typeof jQuery !== 'undefined') {
(function($) {
$('#spinner').ajaxStart(function() {
$(this).fadeIn();
}).ajaxStop(function() {
$(this).fadeOut();
});
})(jQuery);
}
<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) {
<script type="text/javascript">
window.history.forward();
function noBack() { window.history.forward(); }
</script>
</head>
<body onload="noBack();"
onpageshow="if (event.persisted) noBack();" onunload="">