Skip to content

Instantly share code, notes, and snippets.

View juggy's full-sized avatar
🎯
Focusing

Julien Guimont juggy

🎯
Focusing
View GitHub Profile
I have:
Skepic.DashPlot = Backbone.View.extend
...
But want (dash_plot is a precreated object):
((dash_plot)->
dash_plot.extend Backbone.View,
...
- content_for :scripts do
= javascript_include_tag "app/application"
= javascript_include_tag "app/templates/all"
:javascript
S.set("quote", S.store.find(S.models.Quote, S.store.load(S.models.Quote, #{QuoteSerializer.new(Quote.find(params[:id])).to_json}.quote).id));
console.log("data loaded")
- content_for :sidebar do
%script{type:"text/x-handlebars"}
{{view S.views.SidebarView}}
@juggy
juggy / active_state.coffee
Created May 14, 2012 18:42
Link state with view, controller, model
Ember.ActiveState = Ember.LayoutState.extend
isActive: false
enter: (manager, transition)->
@_super(manager, transition)
@set("isActive", true)
exit: (manager, transition)->
@_super(manager, transition)
@set("isActive", false)
//
// The logic here is the transitionend event fires instantly
// after the transition is done (1ms here). I have seen timeouts
// taking up to 300ms to fire (!) so the main avantage is responsiveness.
//
window.requestTimeout = (function(){
var vendors = 'Webkit Moz O ms Khtml'.split(' '),
supports = (function() {
var div = document.createElement('div'),
len = vendors.length;
class Core::PaginationSerializer < ActiveModel::ArraySerializer
def initialize(object, options={})
meta_key = options[:meta_key] || :meta
options[meta_key] ||= {}
pobject = options[:pagination_object] || object
options[meta_key][:pagination] = {
current_page: pobject.current_page,
next_page: pobject.next_page,
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'th',
downArrow: '&#9660;',
upArrow: '&#9650;',
actions: {
sortBy(model, sortProperty, order) {
// Remove all selected classes from all the header links
@juggy
juggy / application.controller.js
Created August 28, 2015 18:40 — forked from patrickarlt/application.controller.js
ember-with-custom-events
import Ember from 'ember';
class ItemRating extends HTMLElement {
createdCallback () {
this.insertAdjacentHTML('afterbegin', `
<a data-rating="1">&#9733;</a>
<a data-rating="2">&#9733;</a>
<a data-rating="3">&#9733;</a>
<a data-rating="4">&#9733;</a>
<a data-rating="5">&#9733;</a>
@juggy
juggy / application.controller.js
Last active December 10, 2015 20:47
nested routes
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
building: Ember.computed(function(){
return {id: 1, name: "BUILDING!"}
})
});
const fieldList = [
{ label: 'Foo Fields', fields: [{name: 'foo', selected: false}] },
{ label: 'Bar Fields', fields: [{name: 'bar', selected: true}] }
]
fields: Ember.computed('[email protected]', function() {
return this.get("fieldList").mapBy("fields");
}),
enabledFields: Ember.computed("fields", "[email protected]", function(){
ubuntu@ip-172-31-21-253:/var/deploy/vroom-staging/web_head/releases/20161004023037/front-end$ ./node_modules/.bin/ember build --environment="production"
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
⠋ BuildingTorii is installed but not configured in config/environment.js!
Build failed.
File: assets/vendor.js (123701:7)
The Broccoli Plugin: [UglifyWriter] failed with:
Error
at new JS_Parse_Error (<anonymous>:1545:18)
at js_error (<anonymous>:1553:11)