1. brew install v8
2. bundle update
Wednesday, January 02, 2013
Monday, December 31, 2012
How to Create DNS Records using Linode API
dns = Fog::DNS.new(provider: 'linode',
linode_api_key: 'your-linode-api-key-goes-here')
zone = dns.zones.create(domain: 'your-domain.com',
email: 'admin@your-domain.com')
zone.nameservers
Create a www version of your site and point to the right IP.
record = zone.records.create(value: '1.2.3.4', name: 'your-domain.com', type: 'A')
To make www.your-domain.com go to the same place, use a cname record:
record = zone.records.create(value: 'your-domain.com', name: 'www', type: 'CNAME')
Thursday, December 13, 2012
to_yaml method y broken in Ruby 1.9
vi ~/.irbrc
YAML::ENGINE.yamler = 'syck'
Save. Now you will be able to use the method y to dump objects in yaml format.
error: The following untracked working tree files would be overwritten by merge: Library/Formula/pbrt.rb
cd /usr/local
git reset --hard origin/master
brew update
Rails 3.2 Tagged Logging
MyLogger = ActiveSupport::BufferedLogger.new(Rails.root.join('log/my_tagged.log'))
MyTaggedLogger.tagged("PAY") { MyTaggedLogger.info "Hello I am working!" }
MyTaggedLogger.tagged("PAY") { MyTaggedLogger.info "Hello I am working!" }
Wednesday, December 05, 2012
NoMethodError: undefined method `y' for main:Object
Rails 3.2.6 and Ruby 1.9.3 gives that error. Resolution: YAML::ENGINE.yamler = 'syck'
Tuesday, December 04, 2012
How to check how long a process has been running
ps -p 64622 -o etime=
PID is 64622
Format is as follows:
16-19:18:35
DD-HH:MM:SS
Monday, December 03, 2012
How to install local gem
1. Download the .gem file.
2. gem unpack file.gem .
. is the current directory
3. Specify in Gemfile:
gem 'name-of-gem', '0.1.0', :path => "/path/to/the/unpacked/gem/directory"
4. bundle install
Friday, November 30, 2012
Turn off generating css.sass and js.coffee files
config.generators.stylesheets = false
config.generators.javascripts = false
in application.rb
Wednesday, November 28, 2012
Install Ruby 2.0 Preview 1 on Mac OS
$ brew install libyaml
$ rvm install ruby-2.0.0-preview1 --with-openssl-dir=$HOME/.rvm/usr --verify-downloads 1
$ rvm install ruby-2.0.0-preview1 --with-openssl-dir=$HOME/.rvm/usr --verify-downloads 1
Thursday, November 08, 2012
Install a specific version of gems from a list of gems in a file
cat gems.txt | while read x; do rvm use @@global && gem install $x -v=2.3.8 ; done
Tuesday, November 06, 2012
Monday, October 29, 2012
Rails Error: Unable to access log file. Please ensure that
log/development.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
Resolution:
Change the line : config.log_level = Logger::INFO
to : config.log_level = :info
in development.rb, production.rb etc.
Wednesday, October 24, 2012
Tuesday, October 23, 2012
constant ActiveSupport::Dependencies::Mutex (NameError)
Problem:
.rvm/gems/ruby-1.8.7-p299@global/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
Ruby gems version 1.8.14
Resolution:
Downgrade gems. gem update --system 1.5.3
Friday, October 19, 2012
The following SSH command responded with a non-zero exit status.
Problem:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` v-root /vagrant
Resolution:
1. On your Mac:
$ vagrant gem install vagrant-vbguest
Since I installed Vagrant as a package (dmg) otherwise do : gem install vagrant-vbguest
2. vagrant up
The gem will automatically install the update. If VM is already running just do : vagrant halt
Reference:
Automatically download and install VirtualBox guest additions in Vagrant
Monday, October 15, 2012
Upgrading GIT on Ubuntu 10.04
- sudo add-apt-repository ppa:git-core/ppa
- sudo apt-get update
- sudo apt-get install git
Notes from stackoverflow. This works.
Thursday, October 04, 2012
Testing Cookies
Notes from Rails Cookbook:
To fully test cookies, you need to test that your application is not only setting the cookies, but also correctly reading them when passed in with a request. To do that create Cookie object and add that to the simulated test Request object, which is setup before every test in the setup method.
Rails cookie tests : https://github.com/rails/rails/blob/master/actionpack/test/dispatch/cookies_test.rb
To fully test cookies, you need to test that your application is not only setting the cookies, but also correctly reading them when passed in with a request. To do that create Cookie object and add that to the simulated test Request object, which is setup before every test in the setup method.
Rails cookie tests : https://github.com/rails/rails/blob/master/actionpack/test/dispatch/cookies_test.rb
Securing Your Server by Closing Unnecessary Ports
I am getting rid of Rails Cookbook dead tree copy I bought in 2007. Notes that are valid for any Rails version.
$ netstat -an
will list all network daemons and the ports they are listening on. This will not show you the service name. To find out do:
$ less /etc/services
This will list the service name and the port number it is running. Diable the service based on your Linux flavor and reboot server to make sure it does not get restarted automatically on reboot.
$ netstat -an
will list all network daemons and the ports they are listening on. This will not show you the service name. To find out do:
$ less /etc/services
This will list the service name and the port number it is running. Diable the service based on your Linux flavor and reboot server to make sure it does not get restarted automatically on reboot.
Subscribe to:
Posts (Atom)