Skip to content

Instantly share code, notes, and snippets.

View arbarlow's full-sized avatar

Alex Barlow arbarlow

  • UK
  • 04:52 (UTC +01:00)
View GitHub Profile
@arbarlow
arbarlow / gist:1208465
Created September 10, 2011 15:59
ERB example
<div class="account-release" id="account-release-<%= release.id %>">
<%= image_tag(release.cover.url(:medium), :class => "release-image") %>
<h1><%= release.name %> (<%= release.release_type %>)</h1>
<p><%= release.release_date.to_s(:long) %></p>
<p><%= release.label != nil ? release.label.name : 'None' %></p>
</div>
#profile
.left.column
#date= print_date
#address= current_user.address
.right.column
#email= current_user.email
#bio= current_user.bio
<table>
{foreach $names as $name}
{strip}
<tr bgcolor="{cycle values="#eeeeee,#dddddd"}">
<td>{$name}</td>
</tr>
{/strip}
{/foreach}
</table>
<ul id="products">
{% for product in products %}
<li>
<h2>{{ product.title }}</h2>
Only {{ product.price | format_as_money }}
<p>{{ product.description | prettyprint | truncate: 200 }}</p>
</li>
{% endfor %}
@(contacts:Seq[models.Contact])
@main(title = "All contacts", current = "list") {
<table id="list">
<thead>
<tr>
<th class="name">Name</th>
<th class="firstname">First name</th>
<th class="birthdate">Birth date</th>
<th class="email">Email</th>
class Animal
constructor: (@name, @age) ->
before_filters: []
@arbarlow
arbarlow / controller.coffee
Created October 17, 2011 19:19
index.coffee
module.exports = class Controller
@relationships = []
constructor: (req, res) ->
# nothing to do here..
@belongs_to: (klass) ->
@relationships.push klass
Process: Carousel [705]
Path: /Applications/Carousel.app/Contents/MacOS/Carousel
Identifier: com.mobelux.Carousel
Version: 1.2 (1.2)
App Item ID: 437548184
App External ID: 5564767
Code Type: X86-64 (Native)
Parent Process: launchd [195]
Date/Time: 2011-12-29 17:16:51.136 +0000
exports.create = function(req, res){
var product = Models.Product.build(req.body);
var errors = product.validate();
if (!errors) {
var image = req.files.image;
product.image = image.name;
console.log(image);
fs.rename(image.path, './public/images/1.jpg', function(err){
# For rails > 3
ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::YAML)
ActiveSupport::XmlMini::PARSING.delete("symbol")
ActiveSupport::XmlMini::PARSING.delete("yaml")
# Rails 2.x
# For 2.x apps, check whether your app sets
# `ActionController::Base.param_parsers[Mime::YAML] = :yaml` and snip that out if it does.
ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING.delete('symbol')
ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING.delete('yaml')