Skip to content

Instantly share code, notes, and snippets.

{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"font_face": "menlo",
"font_size": 14
}
@HeroicEric
HeroicEric / Base File.sublime-settings
Created June 22, 2011 19:09
Settings for Sublime Text 2
// Settings in here override those in "Default/Base File.sublime-settings", and
// are overridden in turn by file type specific settings. Place your settings
// here, to ensure they're preserved when upgrading.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Solarized (light).tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Base File (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
txtred='\033[0;31m'
txtgrn='\033[0;32m'
txtcya='\033[0;36m'
txtpur='\033[;35m'
txtrst='\e[0m' # Text Reset
print_before_the_prompt () {
printf "$txtpur$USER: $PWD\n"
@HeroicEric
HeroicEric / gist:1203997
Created September 8, 2011 17:24
HAML Equivalent?
<script type="text/javascript">
//<![CDATA[
var variant_options = new VariantOptions(
<%== @product.variant_options_hash.to_json %>,
<%== Spree::Config[:allow_backorders] %>
);
//]]>
</script>
source 'http://rubygems.org'
gem 'rails', '3.1.0'
gem 'sqlite3'
gem 'spree', :git => 'git://github.com/spree/spree.git'
gem 'haml-rails'
# Gems used only for assets and not required
# in production environments by default.
--> bundle exec spree extension foobar
create spree_foobar
create spree_foobar/app
create spree_foobar/app/assets/javascripts/admin/spree_foobar.js
create spree_foobar/app/assets/javascripts/store/spree_foobar.js
create spree_foobar/app/assets/stylesheets/admin/spree_foobar.css
create spree_foobar/app/assets/stylesheets/store/spree_foobar.css
create spree_foobar/app/controllers
create spree_foobar/app/helpers
create spree_foobar/app/models
get '/foo' do
"in /foo"
redirect to('/bar')
end
get '/bar' do
"in /bar"
end
# domains/show.html.haml
%h2 Keywords
= link_to "New keyword", new_domain_keyword_path(:domain_id => @domain.id)
# keywords/new.html.haml
= form_for([@domain, @keyword]) do |f|
= f.label :term
= f.text :term
# controllers/keywords_controller.rb
resources :domains do
resources :keywords
end
# keywords_controller.rb
class KeywordsController < ApplicationController
def new
@domain = Domain.find(params[:domain_id])
@keyword = @domain.keywords.new
end
end
# domains/new.html.haml
%h1= @domain.name