Rails only accepts certain http verbs. It is simple enough to tell apache to limit access to passenger
It can also live at the directory or server config level
<VirtualHost *:80>
  ServerName plm.local
  DocumentRoot "/Users/kbrock/projects/plm-website/public"
  RailsEnv development
  <Directory "/Users/kbrock/projects/plm-website/public">
    <LimitExcept POST GET PUT DELETE OPTIONS>
      Order deny,allow
      Deny from all
    </LimitExcept>
  </Directory>
</VirtualHost>

Rails only accepts certain http verbs. It is simple enough to tell apache to limit access to passenger

It can also live at the directory or server config level

<VirtualHost *:80>
  ServerName plm.local
  DocumentRoot "/Users/kbrock/projects/plm-website/public"
  RailsEnv development
  <Directory "/Users/kbrock/projects/plm-website/public">
    <LimitExcept POST GET PUT DELETE OPTIONS>
      Order deny,allow
      Deny from all
    </LimitExcept>
  </Directory>
</VirtualHost>
I want to speed up my local database. So I compromise data integrity by not forcing the syncs. Loose a little bit of the ACID, but get some speed

On homebres, I have this file installed in /usr/local/var/db/postgres/postgres.conf

fsync = off				# turns forced synchronization on or off
synchronous_commit = off		# immediate fsync at commit

I want to speed up my local database. So I compromise data integrity by not forcing the syncs. Loose a little bit of the ACID, but get some speed

On homebres, I have this file installed in /usr/local/var/db/postgres/postgres.conf

fsync = off				# turns forced synchronization on or off
synchronous_commit = off		# immediate fsync at commit
I&#8217;d love to use a game controller like the IshockX to write software.
Wonder why the programming languages are so verbose, filled with nuances, and require so much typing

I’d love to use a game controller like the IshockX to write software.

Wonder why the programming languages are so verbose, filled with nuances, and require so much typing

trying out redcar


# install redcar
rvm use ree
rvm gemset create redcar
rvm use @gemset
gem install redcar
redcar install

# create wrapper
rvm wrapper ree@redcar wrapped redcar

# alias wrapper to redcar
echo -e '\nalias redcar=wrapped_redcar' &gt;&gt; ~/.bashrc
. ~/.bashrc


via redcar lighthouse
image

trying out redcar


# install redcar
rvm use ree
rvm gemset create redcar
rvm use @gemset
gem install redcar
redcar install

# create wrapper
rvm wrapper ree@redcar wrapped redcar

# alias wrapper to redcar
echo -e '\nalias redcar=wrapped_redcar' >> ~/.bashrc
. ~/.bashrc

via redcar lighthouse
image
If you do printf debugging, this adds pretty colors and only shows for the user requesting the logging
# if you want to customize, redefine in initializers
# passenger does not define ENV['USER']
USER=ENV['HOME'].split('/').last

#usage:  my_log 'kbrock', 'UserController#logout', name
#only for me, will log 
def my_log(*args)
  who=args.shift #determine who wants to see this
  if who.nil? || who == USER
    theme=args.shift
    params = args.join ' ' || ''
    params += ' ' + yield if block_given?
    message="\e[1;34m#{theme}\e[0m #{params}"
    Rails.logger.debug(message)
    puts(message) unless Rails.env.test?
  end
end

If you do printf debugging, this adds pretty colors and only shows for the user requesting the logging

# if you want to customize, redefine in initializers
# passenger does not define ENV['USER']
USER=ENV['HOME'].split('/').last

#usage:  my_log 'kbrock', 'UserController#logout', name
#only for me, will log 
def my_log(*args)
  who=args.shift #determine who wants to see this
  if who.nil? || who == USER
    theme=args.shift
    params = args.join ' ' || ''
    params += ' ' + yield if block_given?
    message="\e[1;34m#{theme}\e[0m #{params}"
    Rails.logger.debug(message)
    puts(message) unless Rails.env.test?
  end
end
Private Browsing or cleared your cookies?

heh - go to flash player preferences to see the stuff that you missed.

Private Browsing or cleared your cookies?

heh - go to flash player preferences to see the stuff that you missed.

Tests rebuild database which takes a bit of time. I hacked Rakefile to not rebuild database every time.

Rake::Task['features'].clear_prerequisites   rescue nil # For some super weird reason this fails for some...
Rake::Task['default'].clear_prerequisites    rescue nil
Rake::Task['spec'].clear_prerequisites rescue nil

task :spec          =&gt; %w[db:abort_if_pending_migrations]
task :features      =&gt; %w[db:abort_if_pending_migrations]

desc "Run all tests and features"
task :default =&gt; %w(spec features)

Tests rebuild database which takes a bit of time. I hacked Rakefile to not rebuild database every time.


Rake::Task['features'].clear_prerequisites   rescue nil # For some super weird reason this fails for some...
Rake::Task['default'].clear_prerequisites    rescue nil
Rake::Task['spec'].clear_prerequisites rescue nil

task :spec          => %w[db:abort_if_pending_migrations]
task :features      => %w[db:abort_if_pending_migrations]

desc "Run all tests and features"
task :default => %w(spec features)
Rake task to generate model diagrams in a rails project

namespace :doc do
  desc "document db: (annotate, schema.rb, dot)"
  task :db=&gt;%w(annotate_models db:schema:dump doc:dot)

  desc "Use railroad to generate graphviz dot files"
  task :dot do
    #tack on stuff at the top of the page
    FORMAT=%q{sed 's/graph\\[/  graph[page="8.5,11",\
            size="7.5,10",center=1];\
    node[shape=Mrecord,width="1.2",fillcolor="#cccccc",\
            style="filled", penwidth="2"]\
    edge [ minlen="1.2", penwidth="2"]\
    graph[/'}
  
    now=`rake db:version`.chomp.split(' ')[-1]
    models="doc/models#{now}.dot"
    #hide magic hides created_at, updated_at
   puts `railroad -liM --hide-magic|#{FORMAT}&gt;#{models}`
  
    [models].each do |filename|
      filetype='pdf'
      outfile=filename.gsub('.dot',".#{filetype}")
      #create viewable file (graphviz must be installed)
      puts `dot -T#{filetype} #{filename} -o#{outfile}`

      #open the file using mac graphviz app
      puts `open #{filename} -a graphviz`
    end
  end
end

Rake task to generate model diagrams in a rails project


namespace :doc do
  desc "document db: (annotate, schema.rb, dot)"
  task :db=>%w(annotate_models db:schema:dump doc:dot)

  desc "Use railroad to generate graphviz dot files"
  task :dot do
    #tack on stuff at the top of the page
    FORMAT=%q{sed 's/graph\\[/  graph[page="8.5,11",\
            size="7.5,10",center=1];\
    node[shape=Mrecord,width="1.2",fillcolor="#cccccc",\
            style="filled", penwidth="2"]\
    edge [ minlen="1.2", penwidth="2"]\
    graph[/'}
  
    now=`rake db:version`.chomp.split(' ')[-1]
    models="doc/models#{now}.dot"
    #hide magic hides created_at, updated_at
   puts `railroad -liM --hide-magic|#{FORMAT}>#{models}`
  
    [models].each do |filename|
      filetype='pdf'
      outfile=filename.gsub('.dot',".#{filetype}")
      #create viewable file (graphviz must be installed)
      puts `dot -T#{filetype} #{filename} -o#{outfile}`

      #open the file using mac graphviz app
      puts `open #{filename} -a graphviz`
    end
  end
end
Easiest way I&#8217;ve fount to work with svn is to just use git as the client.
Most people explain how to converting svn to git. This lets me use git as a client for an svn server.
SVN_ROOT=ssh+svn://repo/opt/svn/repo/project1
git svn init -s $SVN_ROOT
git svn fetch
#git checkout -b svnrebase trunk
git rebase --onto trunk --root master
git svn dcommit

Easiest way I’ve fount to work with svn is to just use git as the client.

Most people explain how to converting svn to git. This lets me use git as a client for an svn server.

SVN_ROOT=ssh+svn://repo/opt/svn/repo/project1
git svn init -s $SVN_ROOT
git svn fetch
#git checkout -b svnrebase trunk
git rebase --onto trunk --root master
git svn dcommit

Collect for a hash

module Enumerable
  def hash_map
    hash = {}
    self.each {|o| hash.store(*yield(o))}
    hash
  end
end

my_hash = lines.hash_map {|l| l.split /:/}

Great suggestion on redit for creating a hash from other objects.