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
@hojberg
hojberg / records-bug-transcript.md
Created September 14, 2021 14:06
Unison Records pretty printing transcript

Ensure that Records keep their syntax after being added to the codebase

.> builtins.mergeio
.> load unison-src/transcripts-using-base/base.u

Record with 1 field

@hojberg
hojberg / document_route_target.js
Created November 6, 2014 17:35
aviator example
var DocumentRouteTarget = {
show: function () {
// this function is called for /documents/:id urls like /documents/123
}
};
@hojberg
hojberg / my-model-es6-in-yui.js
Last active August 29, 2015 14:01
YUI to ES6 to YUI
YUI.add('models:my_model', function (Y, NAME, __imports__, __exports__) {
"use strict";
var MyOtherModel = __imports__['models/my_other_model']['default'];
var MyModel = Y.Base.create('models:myModel',
MyOtherModel
[],
{
// .. some implementation
},
@hojberg
hojberg / app_route_target.js
Last active September 5, 2019 09:36
Simple Aviator/React example. Read more about Aviator here: https://github.com/swipely/aviator
/** @jsx React.DOM */
var AppRouteTarget = {
setupLayout: function () {
React.renderComponent({
<App className='page-content'>,
document.querySelector('body')
});
}
};
(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) {
@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,
[],
host[model.isNew() ? "destroy" : "render"]();
// vs
if (model.isNew()) host.destroy();
else host.render();
// 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({});
@contact = Contact.find(params[:id])
raise url_for(contacts_url(@contact))
# http://localhost:3000/contacts.986060960
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