Skip to content

Instantly share code, notes, and snippets.

View shingara's full-sized avatar

Cyril Mougel shingara

  • regate.io
  • Pau ( France )
View GitHub Profile
@shingara
shingara / gist:8589
Created September 3, 2008 14:03
error in Typo 5.1.3
Processing ContentController#index (for 91.121.27.96 at 2008-09-03 12:50:07) [GET]
Session ID: 206ca70bb763c4cbbe25d61edfacf954
Parameters: {"search"=>{"category"=>"5", "published"=>"0", "published_at"=>"", "user_id"=>""}, "action"=>"index", "controller"=>"admin/content"}
ActiveRecord::StatementInvalid (PGError: ERROR: operator does not exist: boolean = integer
LINE 1: ...(state in('published', 'withdrawn') AND published = 0 AND ca...
^
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
: SELECT count(DISTINCT contents.id) AS count_all FROM contents LEFT OUTER JOIN categorizations ON categorizations.article_id = contents.id WHERE (state in('published', 'withdrawn') AND published = 0 AND categorizations.category_id = 5) AND ( (contents."type" = 'Article' ) ) ):
class TraitementsController < ApplicationController
# GET /traitements
# GET /traitements.xml
require 'net/ftp'
def index
@traitements = Traitement.find(:all)
Net::FTP.open("ilidan.dinopol.lan") do |ftp|
require 'mechanize'
user = 'xxxx'
pass = 'xxxx'
a = WWW::Mechanize.new
page_post = a.post("http://#{user}.labrute.fr/login", 'pass' => pass)
3.times do
login = ''
#Controller
before :ensure_authenticated, :exclude => [:index, :show]
def new(project_id)
only_provides :html
@ticket = Ticket.new(:project_id => project_id)
display @ticket, :status => 401
end
# RSPEC
User.fixture {{
:login => /\w+/.gen,
:email => "#{/\w+/.gen}.#{/\w+/.gen}@gmail.com",
:password => "tintinpouet",
}}
Function.fixture(:admin) {{
:name => 'Admin'
}}
@shingara
shingara / gist:38994
Created December 22, 2008 14:03
Datamapper Benchmark
Benchmark with MySQL
shingara ~/data/perso/project/datamapper/dm-core $ ./script/performance.rb
Generating data for benchmarking...
Inserting 10,000 users...
Inserting 10,000 exhibits...
You can specify how many times you want to run the benchmarks with rake:perf x=(number)
Some tasks will be run 10 and 1000 times less than (number)
Benchmarks will now run 10000 times
| AR 2.1 | DM 0.9.8 | DIFF |
# /etc/mysql/my.cnf: The global mysql configuration file.
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/my.cnf-4.1,v 1.4 2008/11/14 02:16:25 robbat2 Exp $
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysql]
shingara@slick ~/data/perso/project/merb/oupsnow $ merb -i
Loading init file from /mnt/data/home_data/perso/project/merb/oupsnow/config/init.rb
Loading /mnt/data/home_data/perso/project/merb/oupsnow/config/environments/development.rb
~ Connecting to database...
~ Loaded slice 'MerbAuthSlicePassword' ...
~ Parent pid: 9989
~ Compiling routes...
~ Activating slice 'MerbAuthSlicePassword' ...
irb: warn: can't alias context from irb_context.
irb(main):001:0> Project.first
slick shingara # ab2 -n 1000 -c 10 http://blog.shingara.fr/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking blog.shingara.fr (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
upstream mongrel_blog_master_dev {
server 127.0.0.1:44500;
}
server {
listen 80;
server_name test.shingara.fr;
access_log /var/log/nginx/test.shingara.fr.access_log main;