Skip to content

Instantly share code, notes, and snippets.

View bj-mcduck's full-sized avatar

BJ McDuck bj-mcduck

View GitHub Profile
@bj-mcduck
bj-mcduck / app.js.coffee
Created March 7, 2014 06:15
Basic Ember Setup for Rails 4, Ember >1, Ember-Data 1Beta7
#= require ./store
#= require_tree ./models
#= require_tree ./controllers
#= require_tree ./views
#= require_tree ./helpers
#= require_tree ./components
#= require_tree ./templates
#= require_tree ./routes
#= require ./router
#= require_self
# app/assets/javascripts/ember-app/templates/partials/_header.js.coffee
%nav.navbar.navbar-default.navbar-fixed-top
.container
.navbar-header
%btn.navbar-toggle{ data: { target: '.navbar-collapse', toggle: 'collapse' }, type: 'button' }
%span.sr-only Toggle Navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= hb 'link-to "index" class="navbar-brand"' do
# app/assets/javascripts/ember-app/controllers/dream_symbol_controllers.js.coffee
App.DreamSymbolsShowController = Ember.ArrayController.extend
dreamSymbolsCount: (->
@get 'model.length'
).property '@each'
App.DreamSymbolsEditController = Ember.ObjectController.extend
actions:
delete: ->
# Show Route
App.DreamSymbolsShowRoute = Ember.Route.extend
model: (params)->
self = @
@store.find('dream_symbol', params.id).then (symbol)->
Ember.RSVP.hash
symbol: symbol
siblings: self.store.findByIds 'dream_symbol', symbol.siblings
setupController: (controller, model)->
attr = DS.attr
App.DreamSymbol = DS.Model.extend
image: attr 'string'
name: attr 'string'
description: attr 'string'
user: DS.belongsTo 'user'
parents: DS.hasMany('dream_symbol', { embedded: 'always' })
children: DS.hasMany('dream_symbol', { embedded: 'always' })
@bj-mcduck
bj-mcduck / dream_symbols_controllers.js.coffee
Created April 18, 2014 19:02
Get stripped version of object array
App.DreamSymbolsNewController = Ember.ObjectController.extend
value: null
categories: (->
# [
# {
# id: 1
# name: "red"
# }
# {
.form-group
%label.control-label.col-sm-2
Name
.col-sm-10
= hb 'input type="text" value=symbol.name class="form-control input-group-large"'
.form-group
%label.control-label.col-sm-2
Category
.col-sm-10
<?php
/*
Plugin Name: REW Twitter Feed Copy
Description: Sidebar Twitter feed
*/
class RewTwitterFeedCopy extends WP_Widget
{
function RewTwitterFeed()
{
# Show action
App.DreamSymbolsShowController = Ember.ObjectController.extend
checkParent: (value)->
parent = @get 'model.parent'
value = value or 'name'
if parent
parent.get value
else
if value is 'name' then 'Dream Symbol' else 'Dream Symbols'
@bj-mcduck
bj-mcduck / my-file.scss
Created November 24, 2014 22:20
third-party-file.scss
//my-file.scss
$my-new-variable: #ccc;
@import 'third-party/third-party-file';