Skip to content

Instantly share code, notes, and snippets.

@bodokaiser
bodokaiser / native_rest_adapter.js
Last active December 18, 2015 22:59
Native REST Adapter for EmberData
(function(App) {
App.Adapter = DS.RESTAdapter.extend({
namespace: null,
serializer: DS.RESTSerializer.extend({
primaryKey: function() {
return '_id';
@10io
10io / Ember Tips.md
Last active December 18, 2015 16:39
Ember.js tips
  • Do not try to return properties from controllers, return the whole object.
    • Eg: If you want to read a property of the first object of hasMany: do not return elements.firstObject.property. The hasMany are lazily loaded, thus not visible for models/controllers! The correct way is this: return the firstObject as computed property(elements.@each) and in the view bind the property. This way when the collection is lazy loaded, the view is notified and will update.
  • Caution with collections in computed properties. You can observe the collection pointer or the collection elements(using @each)! They are different. Observing the collection pointer will notify when the collection is replaced or deleted, but not when an item is added! For this, you need to use @each.
  • Displaying multiple model type on the same page is done with render(you can do it also with outlets but less clean).
  • Observing a collection in order to apply a JQuery plugin is done using a CollectionView with a function observing content. In t
@machty
machty / router-facelift-guide.md
Last active November 11, 2023 06:44
Guide to the Router Facelift

Ember Router Async Facelift

The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.

@machty
machty / new-router-examples.md
Last active April 16, 2020 22:03
How to do cool stuff with the new Router API
@mihkels
mihkels / 1-req.sh
Last active October 24, 2022 19:20
Ubuntu 12.04 with flask + nginx + uwsgi
#!/bin/bash
sudo apt-get update
# Now let's install all the required ubuntu packages
sudo apt-get install build-essential uwsgi nginx uwsgi-plugin-python python-pip
# PS! If you are doing this stuff for fun I do recommend to install nginx from PPA repository
# that you can find here https://launchpad.net/~nginx/+archive/development
@raytiley
raytiley / ember-sortable-list.js
Created March 23, 2013 04:25
Creating a sortable view using the html5sortable plugin and emberjs
// Working on getting html5sortable plugin working
// Key part is needing to call the sortable() method using Ember.run.next
// If called straight away the functionality quickly gets applied, but then is lost
// At least that's what it looks like when stepping through chrome debugger
// http://farhadi.ir/projects/html5sortable/
App.SortableView = Ember.CollectionView.extend({
tagName: 'ul',
itemViewClass: 'App.SortableItemView',
@alexspeller
alexspeller / gist:5143497
Created March 12, 2013 14:48
Ember data 36d2e2a dist
// Last commit: 36d2e2a (2013-03-11 17:37:25 -0700)
(function() {
window.DS = Ember.Namespace.create({
// this one goes past 11
CURRENT_API_REVISION: 12
});
})();
// Version: v1.0.0-pre.4-55-g11ab37f
// Last commit: 11ab37f (2013-01-27 14:30:02 -0800)
(function() {
/*global __fail__*/
/**
Ember Debug
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: