last_response
.body
last_request
.path
.url
.session
.cookies
require "minitest/autorun" | |
require_relative "../lib/conversor_de_numero_romano.rb" | |
class TestConversorDeNumeroRomano < MiniTest::Unit::TestCase | |
def teste_deve_entender_o_simbolo_I | |
romano = ConversorDeNumeroRomano.new | |
numero = romano.converte 'I' | |
assert_equal 1, numero | |
end |
Warden::Manager.serialize_into_session{|user| user.id } | |
Warden::Manager.serialize_from_session{|id| User.get(id) } | |
Warden::Manager.before_failure do |env,opts| | |
# Sinatra is very sensitive to the request method | |
# since authentication could fail on any type of method, we need | |
# to set it for the failure app so it is routed to the correct block | |
env['REQUEST_METHOD'] = "POST" | |
end | |
require 'sinatra' | |
require 'warden' | |
class YourApp < Sinatra::Application | |
get "/" do | |
erb 'index'.to_sym | |
end | |
get "/protected_pages" do |
class Song | |
include DataMapper::Resource | |
property :id, Serial | |
property :title, String | |
property :lyrics, Text | |
property :length, Integer | |
property :released_on, Date | |
def released_on=date | |
super Date.strptime(date, '%m/%d/%Y') | |
end |
I18n.locale='pt-BR' | |
PagSeguro.configure do |c| | |
c.token= 'X89X78XX72034XX7XXXC6X73X146978X' | |
c.email= 'xxxxxx@xxxxxx.xxx.xx' | |
end |
class YourController < ApplicationController | |
def new | |
@model = YourModel.new | |
end | |
def create | |
#set from the views | |
@model = YourModel.new(params[:model]) | |
#set manual | |
@model.anything= '...' |
require 'sinatra' | |
# Listen on all interfaces in the development environment | |
set :bind, '0.0.0.0' | |
get '/' do | |
"Hello World! Is it " + settings.bind + " you're looking for?" | |
end |
sudo apt-get install imagemagick mplayer gtk-recordmydesktop | |
#Then use Desktop Recorder to capture a portion of the screen/application to use as the screencast. | |
mplayer -ao null <video file name> -vo jpeg:outdir=output | |
#Use ImageMagick to convert the screenshots into an animated gifs. | |
convert output/* output.gif | |
#you can optimize the screenshots this way: | |
convert output.gif -fuzz 10% -layers Optimize optimised.gif |
package br.net.ti2.MarinaAbramovick.config; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | |
@Configuration |