Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Making Yapp better all the time and likely working on some Ember.js OSS

Luke Melia lukemelia

💭
Making Yapp better all the time and likely working on some Ember.js OSS
View GitHub Profile
@lukemelia
lukemelia / README.md
Last active May 2, 2018
Ember Twiddle Demo: Mirage with Ember Twiddle
View README.md

Ember Twiddle Demo: Mirage with Ember Twiddle

Demo

This is a very trivial example of using mirage with Ember Twiddle.

View components.non-yielding-component.js
import Ember from 'ember';
const { computed } = Ember;
const { readOnly } = computed;
export default Ember.Component.extend({
cost: readOnly('delayedCalculation.cost'),
tax: readOnly('delayedCalculation.tax'),
total: computed('cost', 'tax', function() {
return this.get('cost') + this.get('tax');
}),
@lukemelia
lukemelia / batch.js
Created Aug 13, 2012
Batch transaction save
View batch.js
App.profileEditorController = Em.ObjectController.extend({
addressBinding: 'content.address'
});
App.Router = Em.Router.extend({
root: Em.Route.extend({
profile: Em.Route.extend({
route: 'profile',
View gist:3185831
(($)->
$.fn.logoPopup = ->
this.mousedown ->
$(document).bind("contextmenu", (event)->
true
)
if event.which == 3
$('<div id="logo-lightbox-container">').hide().appendTo('body').load('/u/logo', ->
$.easybox("#logo-lightbox-container")
)
View model.js
App.ProjectSelectView = Ember.CollectionView.extend({
selected: null,
itemViewClass: Ember.View.extend({
attributeBindings:['selected'],
valueBinding: 'content.selected'
}),
valueChanged: function(){
this.$().val( this.get('selected') );
}.observes('selected'),
@lukemelia
lukemelia / index.rb
Created Jul 11, 2011 — forked from nesquena/index.rb
Example of using extends
View index.rb
object @posts
attributes :id, :title, :created_at
child :user do
extends "users/show"
end
View gist:83377
require "benchmark"
x = 10_000
first_id = Sport.first.id
key = "Sport:#{first_id}"
Sport.set key, Sport.find(first_id) # prime cache
Benchmark.bm(20) do |b|
b.report "Sport.get" do