Skip to content

Instantly share code, notes, and snippets.

View alexspeller's full-sized avatar
🏁

Alex Speller alexspeller

🏁
View GitHub Profile
@alexspeller
alexspeller / hack.sh
Created March 31, 2012 11:35 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
Library.BooksNewController = Ember.ObjectController.extend
save: ->
@get('model').save().then =>
@transitionToRoute('books.book', @get('model'))
console.log 'here'
@alexspeller
alexspeller / router.js
Last active December 20, 2015 21:28 — forked from bricker/router.js
ArticlesRoute = Em.Route.extend({
model: function() {
Article.find({page: 1});
return Article.all();
}
});
ArticlesController = Em.ArrayController.extend({
currentPage: 1,
LibraryAdapter = Ember.RESTAdapter.extend
didFind: (record, id, data)->
if /^code:/.test(id)
id = data.id
record.load(id, data)
// RESOURCES
filteredContent: function() {
var view = this;
active_asset = view.get('settings.active_asset'),
active_playlist = view.get('parentView.settings.active_playlist'),
smart_playlist = ['all', 'pending_review', 'reviewed', 'approved'],
content = view.get('context.resources');
view.set('activePlaylist', null);
switch(active_playlist) {
Admin.RefreshableModel = Em.Object.extend({
/**
* Keeps reloading a given model from the server. To stop this process, just
* kill the `timer` variable.
*/
reload: function(model) {
if(this.timer) { this.stop(); }
this.model = model;
this.timer = Em.run.later(this, '_reload', 15000);
@alexspeller
alexspeller / gist:6698048
Last active December 23, 2015 21:39 — forked from abuiles/gist:6698011
model.get('foos').then (foos) ->
foos.get('firstObject')
@alexspeller
alexspeller / router.js
Last active December 24, 2015 17:29 — forked from anonymous/router.js
// For more information see: http://emberjs.com/guides/routing/
App.Router.map(function() {
this.resouce('plan', function() {
this.resource('projects', function() {
this.resource('project', {path: ':project_id'})
});
});
});
{{view App.TimePickerView name='timepicker'}}
App.TimePickerView = Ember.View.extend({
templateName: 'timepicker',
didInsertElement: function() {
this.$('[name=' + this.get('name') + ']').timepicker({
minuteStep: 1,
showSeconds: true,
//This is in the appliation route:
setupController:function(controller, model) {
this._super(controller, model);
this.filterable(['ingredient', 'recipe']).then(function(array) {
controller.set('itemCollection', array)
});
},