- Email: [email protected]
- Twitter: @hmans
- Website or Blog: http://hmans.io
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
require 'freddie' | |
class Event | |
include Mongoid::Document | |
# ... | |
end | |
class App < Freddie::App | |
resource :events do | |
permit do |user| |
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
run Freddie(:redirect, '/events') do | |
layout 'application' | |
child 'events', Freddie(:resource, Event) # full Rails-style RESTful web resource. :) | |
child 'application.css', Freddie(:stylesheet, 'application.css.scss') | |
child 'application.js', Freddie(:static, 'views/application.js', content_type: 'text/javascript') | |
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
app = Freddie do | |
path 'one' do | |
render "1" | |
path 'two' do | |
render "2" | |
path 'three' do | |
render "3!" | |
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
run Freddie do | |
layout 'application.html.haml' | |
# Serve some asset files | |
# | |
path('application-:timestamp.css') { stylesheet 'application.scss' } | |
path('application-:timestamp.js') { javascript 'application.js' } | |
# Built-in OmniAuth support | |
# |
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
for ruby in $HOME/.rbfu/rubies/*; do rbfu @${ruby##*/} bundle && bundle exec rake ; done |
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
# So I wrote this cute little currency view formatting helper. Enjoy. | |
# | |
# (On a side note, shortly after writing this, I decided to use the awesome | |
# Money gem in my project, rendering most of this code obsolete.) | |
# | |
def currency(v, options = {}) | |
options = { | |
:symbol => "€", | |
:separator => ".", | |
:decimal_separator => ",", |
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
# install happy-cli prerelease (!) gem | |
gem install happy-cli --pre | |
# create a new happy app using the standard app template | |
happy new myapp | |
# alternatively, use the minimal template | |
happy new myapp -t minimal | |
# then: |
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
# Require the compass gem. No need to do this if you're already requiring all your | |
# gems through Bundle.require. | |
# | |
require 'compass' | |
# This adds the stylesheets directory of the "compass" engine to Sass' default load path. The | |
# only other engine in Compass at the time of writing is "blueprint", which, as far as I | |
# know, is already tagged as deprecated. | |
# | |
Sass::Engine::DEFAULT_OPTIONS[:load_paths] << Compass::Frameworks["compass"].stylesheets_directory |