Skip to content

Instantly share code, notes, and snippets.

View hmans's full-sized avatar
🚀
Let's go!

Hendrik Mans hmans

🚀
Let's go!
View GitHub Profile
@hmans
hmans / whatever-manifesto.md
Created April 23, 2012 16:30
The Whatever Manifesto

THE WHATEVER MANIFESTO

  1. Follow your dreams (or don't. Whatever.)
  2. Work sane hours (or don't. Whatever.)
  3. Separate work from life (or don't. Whatever.)
  4. Build a fun side project (or don't. Whatever.)
  5. Always be open to new ideas (or don't. Whatever.)
  6. Learn how to manage your money (or don't. Whatever.)

Whatever it is that you choose to do, follow these two simple rules:

@hmans
hmans / manifesto-manifesto.md
Created April 24, 2012 12:57
The Manifesto Manifesto
@hmans
hmans / app.rb
Created May 1, 2012 00:59
Work in progress...
require 'freddie'
class Event
include Mongoid::Document
# ...
end
class App < Freddie::App
resource :events do
permit do |user|
@hmans
hmans / config.ru
Created May 4, 2012 18:19
Freddie objects!
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
app = Freddie do
path 'one' do
render "1"
path 'two' do
render "2"
path 'three' do
render "3!"
end
@hmans
hmans / config.ru
Created May 6, 2012 14:08
More work in progress...
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
#
@hmans
hmans / gist:2816142
Created May 27, 2012 22:17
Test your code against all installed Ruby versions (using rbfu)
for ruby in $HOME/.rbfu/rubies/*; do rbfu @${ruby##*/} bundle && bundle exec rake ; done
@hmans
hmans / gist:2858354
Created June 2, 2012 13:15
Format currency values.
# 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 => ",",
@hmans
hmans / gist:2891302
Created June 7, 2012 20:16
Happy for the curious.
# 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:
@hmans
hmans / gist:2996065
Created June 26, 2012 14:22
How to use Compass outside Rails or Sinatra (eg., in pure Rack apps or frameworks like Happy)
# 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