This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope :paginate, lambda { |page, per_page| limit(per_page.to_i).offset((page.to_i - 1) * per_page.to_i) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==== General Organizational Principles for CSS and JS in Rails | |
=== Framework requirements | |
1. Modularity | |
2. Complex components are built from simple, atomic components | |
3. Cross-browser compatibility | |
a. Follow W3C standards | |
b. Keep IE hacks in a separate style file | |
4. Bulletproof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'forwardable' | |
require 'pp' | |
# * Schema may be only an array | |
# * It may not contain an array, only a symbol or a hash | |
# * The key of a hash is always a symbol and the value is always an array or array inside an array | |
# * To show that it should iterate through a collection on input, we use array in array | |
class Schema | |
include Enumerable | |
extend Forwardable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$solver_timestamp_sec: 0.01; | |
// Rebound.js-like spring animations in SCSS. | |
// There is a bunch of functions, which helps generating keyframes for you spring | |
// animations, if you (like me) really want to avoid doing that in JavaScript. | |
// | |
// It only generates values for one spring, with given friction, tension and end value | |
// (i.e. it doesn't support spring systems) | |
// Friction and tension are matched to the values used in Origami, so you can use whatever | |
// your designers put in a Quartz Composer file in "Bouncy Animation" blocks :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library maybe; | |
abstract class Maybe<T> { | |
T get value; | |
bool get isEmpty; | |
} | |
class Nothing extends Maybe { | |
get value => null; | |
bool get isEmpty => true; |
OlderNewer