Skip to content

Instantly share code, notes, and snippets.

@zircote
zircote / init_ansible_role.sh
Last active January 8, 2020 04:54
bash function to create a boilerplate ansible role (I am lazy)
#!/bin/sh
function init_ansible_role {
if [[ ! -n $1 ]]; then
echo no init
return
fi
mkdir -p roles/${1}/{defaults,tasks,files,templates,vars,handlers,meta}
for i in defaults tasks vars handlers meta; do
if [[ ! -f roles/${1}/${i}/main.yaml ]]; then
echo creating file: roles/${1}/${i}/main.yaml
@citrus
citrus / _cart_form.html.erb
Created May 31, 2011 18:21
custom variant selection in spree
<% option_count = 0 %>
<%= form_for :order, :url => populate_orders_url do |f| %>
<% if @product.has_variants? %>
<div id="product-variants">
<% if defined?(@options) && !@options.empty? %>
<% @options.each_with_index do |option,index| %>
<% option_count += 1 %>
<% name = option[0].name.downcase %>
<div class="product-options">
<h2>Choose Your <%= name.capitalize %></h2>