This file contains hidden or 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
# Quick hack of regular expressions to convert twitter bootstrap from LESS to Stylus | |
less2stylus = (string) -> | |
string = string | |
.replace(/^(\ *)(.+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets | |
.replace(/^(\ *)([^\ \n]+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets | |
.replace(/\ *\{\ *\n*/g, "\n") # remove opening brackets again (some random cases I'm too lazy to think through) | |
.replace(/\ *\}\ *\n*/g, "\n") # remove closing brackets | |
.replace(/\;\ *?$/gm, "") # remove semicolons | |
.replace(/@(\w+):(\ *)\ /g, (_, $1, $2) -> # replace @variable: with $variable = | |
"$#{$1}#{$2} = " |
This file contains hidden or 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
#this goes in config/application.rb | |
#just before the closing "end" tag | |
#it tels rails generators to use Haml and Mongomapper | |
config.generators do |g| | |
g.orm :mongo_mapper # :active_record | |
g.template_engine :haml | |
g.stylesheet_engine = :sass | |
g.test_framework :rspec, :fixture => true, :views => false | |
end |
This file contains hidden or 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
# Client-side Comet code. See comet_server.coffee for instructions. | |
client = new Faye.Client '/faye', timeout: 90 | |
# Attach a security key to all our subscription messages. | |
client.addExtension | |
outgoing: (msg, callback) -> | |
return callback(msg) unless msg.channel is '/meta/subscribe' | |
(msg.ext ?= {}).authToken = 'secret' | |
callback(msg) |