Skip to content

Instantly share code, notes, and snippets.

@pdjota
pdjota / Writing reasonable markdown
Created December 11, 2010 15:46
Writing reasonable markdown and verifying it
# I'm writing markdown syntax in README
content = File.open("README.markdown").read
markdown = RDiscount.new(content)
puts markdown.to_html
##if it fails, gem i rdiscount
Team.transaction do
u1, u2 = @team.users_teams
u1.position = 'p2'
u2.position = 'p1'
u1.save!
u2.save!
@team.save!
end
@pdjota
pdjota / .autotest
Created July 15, 2011 14:17
.autotest con el mitico grito de Pasman cuando falla.
begin
require "autotest/fsevent"
rescue LoadError
STDERR.puts "gem i autotest-fsevent "
end
Autotest.add_hook :red do
Kernel.system("/usr/bin/afplay ~/no.mp3")
false
end
@pdjota
pdjota / settings.yml
Created September 1, 2011 22:32
Archivo de ejercicio de configuración
development:
ssl: false
localize: false
use_r: false
testing:
ssl: false
localize: false
use_r: true
@pdjota
pdjota / Right query
Created September 28, 2011 18:30
OpenSSL response to Experian Connection
openssl s_client -connect ss3.experian.com:443 -CApath /etc/ssl/certs/
CONNECTED(00000003)
depth=2 /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority - G2/OU=(c) 1998 VeriSign, Inc. - For authorized use only/OU=VeriSign Trust Network
verify return:1
depth=1 /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)09/CN=VeriSign Class 3 Secure Server CA - G2
verify return:1
depth=0 /C=US/ST=Texas/L=mckinney/O=Experian Information Solutions Inc/OU=Systems Integration/OU=Terms of use at www.verisign.com/rpa (c)05/CN=ss3.experian.com
verify return:1
---
Certificate chain
@pdjota
pdjota / Share folders & clipboard
Created October 30, 2011 11:32
VirtualBox notes
# from manual https://www.virtualbox.org/manual/ch04.html#idp11274368
# Include guest additions to ubuntu
# VBoxGuestAdditions.iso. This image file is located in the installation directory of VirtualBox
# Mount the image from: Configuración - Almacenamiento - Controlador IDE - (unidad de cd)
#[check livecd]
@pdjota
pdjota / setup.sh
Created November 2, 2011 13:19
Ubuntu Ruby ready setup
log_file=install.log
touch $log_file
sudo apt-get update --system >> $log_file 2>&1
#build tools, ideas from rvm and railsready.sh
sudo apt-get -y install autoconf automake bison build-essential clang curl git-core libc6-dev libcurl4-openssl-dev libffi-dev libreadline6 libreadline6-dev libssl-dev libtool libxml2 libxml2-dev libxslt-dev libyaml-dev ncurses-dev openssl wget zlib1g zlib1g-dev >> $log_file 2>&1
#database sqlite
sudo apt-get -y install libsqlite3-0 sqlite3 libsqlite3-dev >> $log_file 2>&1
@pdjota
pdjota / gist:1416923
Created December 1, 2011 13:59
test/cases/fixtures_test.rb
class FixtureNameWithSlashIsNotTableNameFixturesTest < ActiveRecord::TestCase
set_fixture_class 'admin/accounts' => Account
fixtures 'admin/accounts'
# Set to false to blow away fixtures cache and ensure our fixtures are loaded
# and thus takes into account our set_fixture_class
self.use_transactional_fixtures = false
def test_named_accessor
assert_kind_of Account, admin_accounts(:signals37)
end
@pdjota
pdjota / empty_database.rb
Created January 5, 2012 13:35
rails rake empty database
current_db = Rails.configuration
.database_configuration[Rails.env]['database']
sql = ActiveRecord::Base.connection()
all_tables = sql.execute "select TABLE_SCHEMA, TABLE_NAME
from information_schema.TABLES
where TABLE_SCHEMA = '#{current_db}'
and TABLE_NAME <> 'schema_migrations';"
@pdjota
pdjota / console.bash
Created January 29, 2012 12:13
Log Error
rake routes
GET / pages#demo
rails s
[2012-01-29 10:15:24] INFO WEBrick 1.3.1
[2012-01-29 10:15:24] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
[2012-01-29 10:15:24] INFO WEBrick::HTTPServer#start: pid=4900 port=3000
[2012-01-29 10:15:45] ERROR ArgumentError: comparison of Fixnum with :debug failed
/home/pablo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/logger.rb:326:in `<'
/home/pablo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/logger.rb:326:in `add'