Skip to content

Instantly share code, notes, and snippets.

View lukemelia's full-sized 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 14:40
Ember Twiddle Demo: Mirage with Ember Twiddle

Ember Twiddle Demo: Mirage with Ember Twiddle

Demo

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

@lukemelia
lukemelia / components.non-yielding-component.js
Last active December 3, 2016 00:59 — forked from krisselden/components.my-component.js
Repro readOnly CP issue II
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 August 13, 2012 20:50
Batch transaction save
App.profileEditorController = Em.ObjectController.extend({
addressBinding: 'content.address'
});
App.Router = Em.Router.extend({
root: Em.Route.extend({
profile: Em.Route.extend({
route: 'profile',
(($)->
$.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")
)
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 July 11, 2011 18:25 — forked from nesquena/index.rb
Example of using extends
object @posts
attributes :id, :title, :created_at
child :user do
extends "users/show"
end
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