Skip to content

Instantly share code, notes, and snippets.

FAQ for CSS Framework (http://gist.github.com/113972)
1. How are you using the "classes" var in JavaScript template?
Often, you need to make some manipulations with DOM objects. We almost don't use ids (#blabla) by our Law, only if this is really necessary for improving performance (if this is bottle-neck). But mostly, we use classes. I suggest to avoid using inline classes (because refactoring here is very often, and we often need to change name of classes), but use classes variable instead. E.g. use:
var classes = { some_class: 'b-something_some-class' };
$('.' + classes.some_class).hide();
FAQ for CSS Framework (http://gist.github.com/113972)
1. How are you using the "classes" var in JavaScript template?
Often, you need to make some manipulations with DOM objects. We almost don't use ids (#blabla) by our Law, only if this is really necessary for improving performance (if this is bottle-neck). But mostly, we use classes. I suggest to avoid using inline classes (because refactoring here is very often, and we often need to change name of classes), but use classes variable instead. E.g. use:
var classes = { some_class: 'b-something_some-class' };
$('.' + classes.some_class).hide();
# == css_js_generator
#
# It generates one big file from all CSS and from all JS small files. It
# scans public/stylesheets and public/javascripts, gets all files from there
# and creates application.css and application.js). Order can be specified
# in css_js_generator.rb. There are also 'notifier' script, it uses
# inotifywatch program for tracking changes in public directory and running
# css_js_generator.rb after every change in public directory. So, big files
# will be generated automatically and you don't need to run it
# css_js_generator.rb after every change of files in public dir.
@astashov
astashov / heroku_submodules_remover
Created August 19, 2009 08:17
Creates/synchronizes new repo in the same parent dir with submodules tracked in the main tree and push the repo to Heroku
#!/bin/bash
current_dir=`pwd`
heroku_dir="${current_dir}_heroku"
function rsync_repo {
# Add trailing slash to source directory to avoid recreating it into $heroku_dir
rsync -r --exclude .git/ ${current_dir}/ $heroku_dir
}
@astashov
astashov / deglobalitor.rb
Created January 21, 2009 07:40
DeGlobalite (if you want to uninstall globalite plugin) the Rails app - change back all :something.l and :smthg.l_with_args(:a => "a") to 'Something' and 'Smthg a'
File.open("lang/ui/en-US.yml") do |file|
while line = file.gets
sym, translate = line.split(":", 2)
Dir['app/views/*/**', 'app/controllers/*', 'app/helpers/*'].each do |path|
lines = ""
File.open( path ) do |f|
lines = f.readlines
end