time bundle exec rake
- real 1m28.383s
- user 1m3.491s
- sys 0m8.299s
ruby-1.9.3-p0
function validateDateFormat(dateValue) { | |
var dateRegex = /^(\d{2})\/(\d{2})\/(\d{4})$/; | |
var dateOK = true; | |
if (!dateValue.blank() ) { | |
if(!dateRegex.test(dateValue)) { | |
dateOK = false; | |
} else { | |
var d = new Date(dateValue.replace(dateRegex, '$2/$1/$3')); | |
var ok = ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && |
select s.table_name, s.column_name, s.data_type, s.character_maximum_length, s.ordinal_position, s.is_nullable, s.column_default, x.conname, x.rel_table | |
from information_schema.columns s | |
left join | |
( | |
SELECT p1.relname AS table, a1.attname AS column, c.conname, p2.relname as rel_table | |
FROM pg_constraint c, pg_namespace n, pg_class p1, pg_class p2, pg_attribute a1, pg_attribute a2, | |
pg_namespace n2 | |
WHERE | |
c.contype = 'f' | |
AND c.confrelid > 0 |
say "I'm assuming that you have RVM and Ruby 1.8.7 or 1.9.2 installed throught it.\n If not, you should!" | |
current_ruby = ask("Which version of ruby is configured? 1.8.7 or 1.9.2?") | |
#create rvmrc file / this was a little tricky (http://stackoverflow.com/questions/3604077/setting-up-rvm-gemset-via-rails-3-template) | |
run "rvm gemset create #{app_name}" | |
run "rvm #{current_ruby}@#{app_name} gem install bundler" #we need to install bundler, otherwise we won't be able to run the bundler install | |
#clean up the Gemfile (I don't like the comments there) | |
remove_file "Gemfile" |
for song in *.mp3; do lame "${song}" "${song}_128.mp3"; done |
iOS Tips | |
======== | |
- métodos que possuem o prefixo "-" são métodos de instância, enquanto métodos com prefixo "+" são métodos de classe; | |
- variaveis de instancia e properties sao a "mesma coisa". através de properties, entretanto, é possível usar "dot notation" | |
- @synthesize gera o getter/setter da propertie automagicamente (entretanto, é possível sobescrever tais métodos, caso necessário) | |
- int x = eye; (chama a variável de instância diretamente) |
<key>ExternalHosts</key> | |
<array> | |
<string>localhost</string> | |
<string>google</string> | |
</array> |
# encoding: UTF-8 | |
class EmailsController < ApplicationController | |
def plano | |
@plano = Plano.find(params[:plan_id], include: [:assistencias]) | |
Notifier.plano(params[:recipients], @plano).deliver! | |
render json: "Email sent successfully", status: :ok | |
rescue => e | |
render json: e.message, status: :bad_request | |
end |
Criar uma nova chave ssh para sua nova conta:
ssh-keygen -t rsa -C "[email protected]" -f ~/.ssh/id_rsa_sua_conta_heroku
Fazer login na nova conta:
heroku auth:login
Fazer upload da nova chave pública gerada:
# usando @user= dentro de um before(:each) | |
rspec spec/models/user_spec.rb | |
......................................................... | |
Finished in 46.62 seconds | |
57 examples, 0 failures | |
Randomized with seed 60306 | |