Skip to content

Instantly share code, notes, and snippets.

View paganotoni's full-sized avatar
💭
⚡️⚡️

Antonio Pagano paganotoni

💭
⚡️⚡️
View GitHub Profile
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:
@paganotoni
paganotoni / counting.js
Created December 14, 2012 19:35
Counting Characters by type.
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
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
@paganotoni
paganotoni / gist:5769704
Created June 12, 2013 22:30
Invite to repo on heroku.
heroku sharing:add [email protected]
@paganotoni
paganotoni / init_static_file.sh
Created August 27, 2013 01:44
Script to init Ruby static Heroku site.
init_static_site(){
PROJECT_NAME=$1
if [[ -z "$PROJECT_NAME" ]] then
PROJECT_NAME="site"
echo "| You didn't define a name for the site folder, setting it to 'site' by default"
fi
mkdir -p $PROJECT_NAME/public/{images,js,css}
touch $PROJECT_NAME/{config.ru,public/index.html}i
cd $PROJECT_NAME && touch Gemfile && echo "source \"https://rubygems.org\"\ngem 'rack'" >> Gemfile
@paganotoni
paganotoni / .vimrc
Created March 17, 2014 22:24
My .vimrc
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@paganotoni
paganotoni / gist:a8ee48624b145b58d35a
Last active August 29, 2015 14:16
Environment Aware
repositories {
grailsHome()
mavenCentral()
grailsCentral()
mavenRepo "http://repo.spring.io/milestone"
}
dependencies {
compile "org.springframework.cloud:cloudfoundry-connector:0.9.5"
compile "org.springframework.cloud:spring-service-connector:0.9.5"
var tumblrAPIURL = "http://api.tumblr.com/v2/blog/wawandco.tumblr.com/posts/text?callback=JSON_CALLBACK&api_key="+$scope.consumerKey;
$http.jsonp(tumblrAPIUrl) .success(function(data){
$scope.posts = data.response.posts;
});
grails prod war && cf push ourApp -p target/ourApp.war