Dec 09
Needed a less css compiler who watches changes to a main .less file as well as all those include with an @import statement.
Weighing the options:
One could just use an old version of the less gem that still supported the —watch option, i.e. the 1.x versions. However, the gem won’t track included/imported files, the obsolete more plugin was required for this in Ruby on Rails.
Peeking over the platform wall, the dotless compiler does all this well under Windows and it’s very fast. However, running this app with mono on Linux will not work with the —watch option, it will stop watching files after all and any file changes. This may be due to different backends of the mono FileSystemWatcher implementation on different Linux platforms, so YMMV.
Meanwhile, the author of less.js has declined to support the —watch option and has rejected at least one merge request with this functionality.
Solution:
Alas, there’s a fork that supports watching the main file as well as all includes:
https://github.com/wvl/less.js
It works great and is stable. All you have to do is clone the repo and add bin/lessc to your path.
Now with a node installation (since recently there is a Windows installer) you should be good to go with silent and effortless server side compilation of less on all platforms.
Aug 30
This may be useful for legacy database, whose table and column names are in CamelCase. Use with extreme caution:
class ChangeAllColumnsToUnderscore < ActiveRecord::Migration
include ActiveRecord::ConnectionAdapters::SchemaStatements
require ‘active_record/connection_adapters/abstract_adapter’
#not needed in Rails 3
#pilfered from here:
#http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-column_exists-3F
def self.column_exists?(table_name, column_name, type = nil, options = {})
columns(table_name).any?{ |c| c.name == column_name.to_s &&
(!type || c.type == type) &&
(!options[:limit] || c.limit == options[:limit]) &&
(!options[:precision] || c.precision == options[:precision]) &&
(!options[:scale] || c.scale == options[:scale]) }
end
def self.up
tables.reject {|t| t == “schema_migrations”}.each do |table|
columns(table.to_sym).each do |column|
unless self.column_exists?(table.to_sym, column.name.underscore.to_sym)
rename_column table.to_sym, column.name.to_sym, column.name.underscore.to_sym
end
end
unless table_exists?(table.underscore.to_sym)
rename_table table, table.underscore
end
end
end
def self.down
tables.reject {|t| t == “schema_migrations”}.each do |table|
columns(table.to_sym).each do |column|
unless column_exists?(table.to_sym, column.name.camelize.to_sym)
rename_column table.to_sym, column.name.to_sym, column.name.camelize.to_sym
end
end
unless table_exists?(table.camelize.to_sym)
rename_table table, table.camelize
end
end
end
end
Hope it helps.
Aug 22
The repo info is here (click and expand that page’s silly javascript widgets), so for OpenSuse 11.4 (use sudo for all commands that need it):
zypper addrepo http://download.opensuse.org/repositories/home:elvigia/openSUSE_11.4/home:elvigia.repo
zypper refresh
zypper install gitosis
Then continue as outlined here, slightly adjusted for OpenSuse with user creation:
groupadd git
useradd git -d /home/git -c ‘git version control’ -s /bin/sh -g git -r -m
sudo -H -u git gitosis-init < /tmp/id_rsa.pub
Then just proceed with
git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git
on your local machine etc. etc.
Aug 21
To install a legacy version of RubyGems, you will need some version installed first, so use aptitude, yum, zypper etc:
apt-get install rubygems
Then revert to an older version (for example 1.3.6):
gem install rubygems-update -v=1.3.6
update_rubygems
Check your version with
gem env
Recent Comments