Skip to content

Instantly share code, notes, and snippets.

View johnmcaliley's full-sized avatar

John McAliley johnmcaliley

View GitHub Profile
<li class="string input required stringish" id="widget_attr_input">
<label class=" label" for="widget_attr">
My Label<abbr title="required">*</abbr>
</label>
<input id="widget_attr" name="widget[attr]" required="required" type="text">
<div class="extra-content-class">My extra HTML Here</div>
<p class="inline-hints">My Hint</p>
</li>
module Formtastic
module Inputs
module Base
module Html
def extra_html
template.content_tag(:div, Formtastic::Util.html_safe(extra_html_text),:class => (options[:extra_html_class] || 'extra-html')) if extra_html?
end
def extra_html?
extra_html_text.present? && !extra_html_text.kind_of?(Hash)
module Formtastic
module Inputs
module Base
module Wrapping
def input_wrapping(&block)
template.content_tag(:li,
[template.capture(&block), error_html, hint_html].join("\n").html_safe,
wrapper_html_options
)
end
@johnmcaliley
johnmcaliley / formtastic_output.html
Created July 18, 2011 14:46
formtastic helper output
<li class="string input required stringish" id="widget_attr_input">
<label class=" label" for="widget_attr">
My Label<abbr title="required">*</abbr>
</label>
<input id="widget_attr" name="widget[attr]" required="required" type="text">
<!-- I WANT TO ADD SOME HTML HERE -->
<p class="inline-hints">
My Hint
</p>
</li>
@johnmcaliley
johnmcaliley / rc.local
Created July 8, 2011 15:13
example that shows nginx startup command
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
#start nginx
/usr/local/nginx/sbin/nginx
@johnmcaliley
johnmcaliley / nginx.conf
Created July 8, 2011 15:02
sample nginx config for rails with Thin app server
user nobody;
worker_processes 1;
error_log /usr/local/nginx/logs/error.log warn;
events {
worker_connections 1024;
}
http {
include /usr/local/nginx/conf/mime.types;
require('mongoose')
var express = require('express')
, resource = require('express-resource')
, app = express.createServer();
// SET UP RESOURCES
var merchants = app.resource('merchants', require('./resources/merchant'));
var products = app.resource('products', require('./resources/product'));
// NEST RESOURCE
exports.index = function(req, res){
res.send('product index');
};
exports.new = function(req, res){
res.send('new product');
};
exports.create = function(req, res){
res.send('create product');
exports.index = function(req, res){
res.send('merchant index');
};
exports.new = function(req, res){
res.send('new merchant');
};
exports.create = function(req, res){
res.send('create merchant');
@johnmcaliley
johnmcaliley / app.js
Created July 1, 2011 18:00
initialize express and express-resource
require('mongoose')
var express = require('express')
, resource = require('express-resource')
, app = express.createServer();
app.listen(3000);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);