This file contains 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
heroku sharing:add [email protected] |
This file contains 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
Ref http://devcenter.heroku.com/articles/custom-domains | |
Heroku Setup | |
1. Install Custom Domain Plugin for your app | |
heroku addons:add custom_domains | |
2. Add domain names | |
heroku domains:add www.example.com | |
GoDaddy Setup | |
1. Go to your domain under your account |
This file contains 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
var pass = document.basic.password.value; | |
var chars = pass.length; | |
var l_let = pass.match(/[a-z]/g).length; | |
var u_let = pass.match(/[A-Z]/g).length; | |
var num = pass.match(/\d/g).length; | |
alert( | |
"# Chars: "+chars+"\n"+ | |
"# Lower: "+l_let+"\n"+ | |
"# Upper: "+u_let+"\n"+ | |
"# Numbers: "+num |
This file contains 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
Groovy also has a Time Category class which gives you DSL style syntax for manipulating dates. Here is an example: | |
import org.codehaus.groovy.runtime.TimeCategory | |
now = new Date() | |
println now | |
use(TimeCategory) { | |
footballPractice = now + 1.week - 4.days + 2.hours - 3.seconds | |
} | |
println footballPractice | |
which will produce output like this: |
This file contains 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
upstream app_server { | |
server 127.0.0.1:8080 fail_timeout=0; | |
} | |
server { | |
listen 80; | |
listen [::]:80 default ipv6only=on; | |
server_name ci.yourcompany.com; | |
location / { |
This file contains 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
#!/bin/bash | |
# | |
# tomcat7 This shell script takes care of starting and stopping Tomcat | |
# | |
# chkconfig: - 80 20 | |
# | |
### BEGIN INIT INFO | |
# Provides: tomcat7 | |
# Required-Start: $network $syslog | |
# Required-Stop: $network $syslog |
This file contains 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
boolean portTaken = false; | |
ServerSocket socket = null; | |
try { | |
socket = new ServerSocket(portNumber); | |
} catch (IOException e) { | |
portTaken = true; | |
} finally { | |
// Clean up | |
if (socket != null) socket.close(); | |
} |
This file contains 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
#!/usr/bin/env groovy | |
public class PrimeNumberEvaluator { | |
// Evaluates a number looking if its prime or not | |
static boolean isPrime( def number ){ | |
def divisors = [] | |
for( def possibleDivisor in (1..number) ){ | |
if( (number % possibleDivisor) == 0 ){ divisors << possibleDivisor } | |
if( divisors.size() > 2 ){ break } |
This file contains 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
# This is a short collection of tools that are useful for managing your | |
# known_hosts file. In this case, I'm using the '-f' flag to specify the | |
# global known_hosts file because I'll be adding many deploy users on this | |
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts | |
# Add entry for host | |
ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts | |
# Scan known hosts | |
ssh-keygen -f /etc/ssh/ssh_known_hosts -H -F github.com |
This file contains 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
includeTargets << grailsScript("_GrailsInit") | |
import com.amazonaws.auth.* | |
import com.amazonaws.services.s3.* | |
import com.amazonaws.services.elasticbeanstalk.* | |
import com.amazonaws.services.elasticbeanstalk.model.* | |
def projectWarFilename | |
def optionMap = [scripts: []] |