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 / 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
@hmans
hmans / speaker.md
Created June 30, 2012 10:23 — forked from matiaskorhonen/speaker.md
Frozen Rails Talk Proposal Template (http://2012.frozenrails.eu/)
@hmans
hmans / cheesecake.md
Last active April 28, 2020 20:56
Motherfucking Cheesecake

MOTHERFUCKING CHEESECAKE

Zutaten:

Für den Boden:

  • 150g Vollkornbutterkekse
  • 2 EL Zucker
  • Prise Zimt
  • 60g weiche Butter