Skip to content

Instantly share code, notes, and snippets.

View gravis's full-sized avatar

Philippe Lafoucrière gravis

View GitHub Profile
class UpdateConfirmedUserView < ActiveRecord::Migration
self.up
execute `git show 2d308a6:sql/confirmed_users_view.sql`
end
self.down
execute `git show 1596b6d:sql/confirmed_users_view.sql`
end
CREATE OR REPLACE VIEW confirmed_user AS
SELECT * FROM users WHERE confirmed_at IS NOT NULL;
class UpdateConfirmedUserView < ActiveRecord::Migration
self.up
execute <<-EOF
CREATE OR REPLACE VIEW confirmed_user AS
SELECT * FROM users WHERE confirmed_at IS NOT NULL
AND disable IS FALSE;
EOF
end
class CreateConfirmedUserView < ActiveRecord::Migration
self.up
execute <<-EOF
CREATE VIEW confirmed_user AS
SELECT * FROM users WHERE confirmed_at IS NOT NULL;
EOF
end
self.down
# in config/environments/production.rb :
# Make sure the cookie is secure
ActionController::Base.session_options[:secure] = true
# in config/environment.rb :
config.action_controller.session = {
:key => '_myapp_session',
:secret => 'super_very_long_key_more_than_30_chars',
#:secure => true, # Only enable secure here if your dev env is using ssl, which is certainly not the case
:expire_after => 3600 # 1 hour
}
# in config/environment.rb:
config.action_controller.session = {
:key => '_myapp_session',
:secret => 'super_very_long_key_more_than_30_chars'
}
#! /usr/bin/rackup
#\ -w -p 8765
map '/' do
run Proc.new {|env|
req = Rack::Request.new(env)
if req.params['PARAM1'] and req.params['PARAM2'] and req.params['PARAM3'] and req.params['PARAM4'] and req.params['PARAM5'] and env['HTTP_HEADER1'] and env['HTTP_HEADER2']
[200, {"Content-Type" => "text/html"}, ["Data Sent"]]
else
puts req.params
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="./include/CJCommon.xsd" />
<xs:element name="OUVINFOPERSO">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="1">
<!-- Entete -->
<xs:element minOccurs="1" maxOccurs="1" ref="IDOper" />
<xs:element minOccurs="1" maxOccurs="1" ref="DateEvt" />
<xs:element minOccurs="1" maxOccurs="1" ref="IDEvt" />
#! /usr/bin/env ruby
# Typhoeus::Multi bug demo
require 'rubygems'
require 'typhoeus'
e = Typhoeus::Easy.new
e.url= "https://www.google.com"
e.method = :post
e.headers = {:TEST => "TEST"}