Skip to content

Instantly share code, notes, and snippets.

View elmariofredo's full-sized avatar
💭
building Cloud Native Thermostat 🔥 🥶

Mario Vejlupek elmariofredo

💭
building Cloud Native Thermostat 🔥 🥶
View GitHub Profile
# did not return nil exception
to_s >> to_splat. nil.to_splat
# Multiple splats allowed
def foo(*a)
a
end
foo(1, *[2,3], 4, *[5,6]) # => [1, 2, 3, 4, 5, 6]
a = [1,2,3]
http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
http://github.com/mbleigh/haml-rails
http://github.com/thoughtbot/factory_girl
#
# wb_utils.grt.py
# MySQLWorkbench
#
# Created by Kuru on 25/Mar/10.
# Copyright (c) 2010 KuruLab. There are many rights to fuckup... Ricky TPB.
#
# This Pyhon script simply export your MySQLWorkBench project to rails scaffold commandline
# This is just concept of final plugin which i hope will be in old good pure ruby... depends on oracle now ;-)
#
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta3'
# Haml and Sass - templating engines
# > http://github.com/nex3/haml
gem "haml"
# MySQL API module for Ruby
# > http://rubygems.org/gems/mysql
# Template for simple_form(http://github.com/plataformatec/simple_form)
# Place in $RAILS_ROOT/lib/templates/haml/scaffold/_form.haml.erb
=simple_form_for(@<%= singular_name %>) do |f|
=f.error_messages
.inputs
<%- attributes.each do |attribute| -%>
=f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>
# Configure generators values. Many other options are available, be sure to check the documentation.
config.generators do |g|
g.template_engine :haml
g.stylesheets false
g.test_framework :shoulda
g.fallbacks[ :shoulda ] = :test_unit
g.ficture_replacement :factory_girl
end
# This template installs the new jQuery drivers, removes
# the old prototype drivers, and installs an initializer
# which overrides the javascript_include_tag to include
# jQuery and the new drivers with :default
# Written by: Logan Leger, [email protected]
# http://github.com/lleger/Rails-3-jQuery
# Downloading latest jQuery.min
exec "curl -L http://code.jquery.com/jquery-latest.min.js > public/javascripts/jquery.js"
# Switch the javascript_include_tag :defaults to use jQuery instead of
# the default prototype helpers.
# Credits: http://webtech.union.rpi.edu/blog/2010/02/21/jquery-and-rails-3/
# $RAILS_ROOT/config/initalizers/jquery.rb
if ActionView::Helpers::AssetTagHelper.const_defined?(:JAVASCRIPT_DEFAULT_SOURCES)
ActionView::Helpers::AssetTagHelper.send(:remove_const, "JAVASCRIPT_DEFAULT_SOURCES")
end
ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery', 'rails']
ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
# Rails 3 bootstrap
# run with
# git clone git://gist.github.com/427005.git && bash "427005/Rails 3 Bootstrap.sh" && rm -rf 427005
# Setup gems
cat > Gemfile <<EOF
source 'http://rubygems.org'