Skip to content

Instantly share code, notes, and snippets.

View hojberg's full-sized avatar
🔮
Building UIs for Unison

Simon Højberg hojberg

🔮
Building UIs for Unison
View GitHub Profile
# this assert
assert ActionMailer::Base.deliveries.present?
# gives this error when running tests
NoMethodError: undefined method `deliveries' for #<TMail::Mail:0x1094e3a90>
/test/unit/user_test.rb:69:in `test_should_create_token_and_email'
var app = wrench.appify({
init: function () {
// this will run after in the boot up process initiated by app.run();
},
users: {
list: route("users/list/").to(function () {
// fetch all the users and show them on the page
}),
<!-- anchor -->
<a class="button_init normal" onclick="$('pre_button').hide(); $('add_quick_switch_form').show();" type="button"><span>&nbsp;Add..</span><em>&nbsp;</em></a>
<!-- button -->
<button class="button_init normal" onclick="" type="submit"><span>&nbsp;Update User</span><em>&nbsp;</em></button>
<?php
/*
Template Name: Page with downloads
*/
?>
<?php the_post(); ?>
<?php get_header(); ?>
<?php get_sidebar(); ?>
<div id="mainContent">
class Release < ActiveRecord::Base
has_many :release_sites
has_many :sites, :through => :release_sites
end
class Site < ActiveRecord::Base
has_many :release_sites
has_many :releases, :through => :release_sites
end
@contact = Contact.find(params[:id])
raise url_for(contacts_url(@contact))
# http://localhost:3000/contacts.986060960
// THIS IS A SUPER PRESENTER?!
YUI.add("presenters:your_rewards", function (Y) {
Y.YourRewardsPresenter = Y.Base.create("YourRewardsPresenter", Y.Presenter, [], {
initializer: function (options) {
this.yourPlacesPresenter = new Y.YourPlacesPresenter({});
this.yourCashPresenter = new Y.YourCashPresenter({});
host[model.isNew() ? "destroy" : "render"]();
// vs
if (model.isNew()) host.destroy();
else host.render();
@hojberg
hojberg / gist:3135950
Created July 18, 2012 12:36
Mediator/layout/master view example
YUI.add('location-search-view', function (Y) {
/**
@class LocationSearchView
@extends View
@constructor
**/
Y.LocationSearchView = Y.Base.create('view',
Y.View,
[],
(function () {
// initiate the application loader
var appLoader = new Swipely.AppLoader({
slowText: 'Hold tight, almost done...',
errorText: "Oh dear, we had a problem loading. We're sorry, please try again."
});
// boot the application
YUI().use('partners:app', function (Y) {