Skip to content

Instantly share code, notes, and snippets.

View dx7's full-sized avatar

Rafael Almeida de Carvalho dx7

View GitHub Profile
@dx7
dx7 / gist:1444983
Created December 7, 2011 22:17
adoro erros inconsistentes

[439015.360] (EE) Screen(s) found, but none have a usable configuration.

[439015.360]

Fatal server error:

[439015.360] no screens found

@dx7
dx7 / gist:1510553
Created December 22, 2011 14:50
Rails 3.2.0.rc1 has strange behavior when using ActiveRecord::QueryMethods#select

Rails 3.1

Loading development environment (Rails 3.1.3)
ruby-1.9.3 irb> user = User.select(:email).first
 => #<User email: "rafaeldx7@..."> 
ruby-1.9.3 irb> user.respond_to? :created_at
 => true 
ruby-1.9.3 irb> user.created_at
 => nil
@dx7
dx7 / .inputrc
Created January 11, 2012 23:15
.inputrc
# my .inputrc file
# allow you to start typing a command and use the up/down arrow to auto complete from commands in your history
"\e[B": history-search-forward
"\e[A": history-search-backward
# Rspec formatter by RAFAELDX7
# Use: rspec --require "dx7_formatter.rb" --format Dx7Formatter -- ./spec/your_spec.rb
require 'rspec/core/formatters/base_text_formatter'
class Dx7Formatter < RSpec::Core::Formatters::BaseTextFormatter
def index
@index ||= -1
@index += 1
@dx7
dx7 / gist:2031859
Created March 13, 2012 21:39
You CAN inherit from a Rails::Application child!
class Settings < YourAppName::Application
end
# The Problem:
# ==> .../.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.2/lib/rails/railtie/configurable.rb:12:in `inherited':
# You cannot inherit from a Rails::Application child (RuntimeError)
# Because:
# http://apidock.com/rails/Rails/Application/Configurable/ClassMethods/inherited
@dx7
dx7 / gist:2511153
Created April 27, 2012 17:44
Install Ruby 1.9.2 with rvm without remove Xcode 4.3
# Run:
# bash < <(curl -Ls https://raw.github.com/gist/2511153)
# Source: http://caiustheory.com/install-gcc-421-apple-build-56663-with-xcode-42
echo "Grab and unpack the tarball."
mkdir ~/tmp && cd ~/tmp
curl -O http://opensource.apple.com/tarballs/gcc/gcc-5666.3.tar.gz
tar zxf gcc-5666.3.tar.gz
cd gcc-5666.3
@dx7
dx7 / gist:2930888
Created June 14, 2012 15:05
Uninstalling all ruby gems
gem list --local --no-versions | xargs gem uninstall -a -x
@dx7
dx7 / gist:2978998
Created June 23, 2012 16:57
Macbook Especificações
Macbook White Unibody 13-inch
Processor: 2.26 GHz Intel Core 2 Duo
Memory: 4 GB 1333 MHz DDR3
Graphics: NVIDIA GeForce 9400M 256 MB
Software: Mac OS X Lion 10.7.3
HD: 250 GB SATA Disk
VENDIDO
Bem interessante esse iGist. A acho que eh uma maneira bem simples de escrever textos e compartilhar via iphone.
@dx7
dx7 / gist:3669571
Created September 7, 2012 21:00
Ruby with PHP Feelings
# Ruby Ree 1.8.7
$ irb
ree-1.8.7 irb> 80 * "#"
TypeError: String can't be coerced into Fixnum
from (irb):1:in `*'
from (irb):1
ree-1.8.7 irb> "#" * 80
=> "################################################################################"