Skip to content

Instantly share code, notes, and snippets.

View behrangsa's full-sized avatar
💾

Behrang Saeedzadeh behrangsa

💾
View GitHub Profile
// mavenCentral()
// mavenRepo "http://download.java.net/maven/2/"
dependencies {
runtime 'javax.activation:activation:1.1.1'
runtime 'javax.mail:mail:1.4.3'
}
mailSender(org.springframework.mail.javamail.JavaMailSenderImpl) {
host = 'smtp.gmail.com'
port = 465
username = '<your email>@gmail.com'
password = '<your password>'
javaMailProperties = ['mail.smtp.auth': 'true',
'mail.smtp.socketFactory.port': '465',
'mail.smtp.socketFactory.class': 'javax.net.ssl.SSLSocketFactory',
'mail.smtp.socketFactory.fallback': 'false']
}
mailSender(org.springframework.mail.javamail.JavaMailSenderImpl) {
host = "smtp.your-domain.com" // your smtp server's address
port = 26 // or your smtp server's port
username = "username@your-domain.com" // if your smtp server requires authentication
password = "your password" // if your smtp server requires authentication
}
@behrangsa
behrangsa / Main.java
Created June 5, 2011 14:03
Project Euler, Question 1
package org.behrang.euler.q1;
public class Main {
public static void main(String[] args) {
long answer = 0;
for (int i = 0; i < 1000; i++) {
if (i % 3 == 0 || i % 5 == 0) {
answer += i;
}
class Post << ActiveRecord::Base
trimify :title, :body
end
@behrangsa
behrangsa / post.rb
Created June 12, 2011 08:38
Post, #2
class Post << ActiveRecord::Base
trimify :title, :body, :nilify => false
end
@behrangsa
behrangsa / index.html
Created June 25, 2011 22:50
HTML Page
<!DOCTYPE html>
<html>
<head>
<title>Gorgeous Login Form Demo</title>
<link href='http://fonts.googleapis.com/css?family=Ubuntu&amp;v1' rel='stylesheet' type='text/css' />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/reset-fonts-grids/reset-fonts-grids.css" />
<link rel="stylesheet" type="text/css" href="login-form.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.microsoft.com/ajax/jquery.ui/1.8.13/themes/redmond/jquery-ui.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js"></script>
body {
font-size: 14px;
}
ul#login-details {
padding: 10px;
padding-top: 50px;
width: 500px;
margin: 0 auto;
}
@behrangsa
behrangsa / login-form.js
Created June 25, 2011 22:52
JavaScript
(function() {
/**
* Adds an animation effect to the given input element's label so that when some text
* is entered in the field, the label moves up and when the field is empty, the label
* goes back to its initial place. This function only works with the accompanying CSS
* styles.
*/
function installAnimation(inputElem, marginTopEnd, animationLength) {
$(inputElem).bind('input', function() {
var label = $(this).prev("label");