Skip to content

Instantly share code, notes, and snippets.

View ivanvanderbyl's full-sized avatar
🏔️

Ivan Vanderbyl ivanvanderbyl

🏔️
View GitHub Profile
@ivanvanderbyl
ivanvanderbyl / Instructions.md
Last active March 10, 2017 14:54
Fix <base> tag in Ember so that SVG patterns and defs work correctly
  1. Add this to your devDependencies in package.json.
"ember-cli-replace": "^0.3.0",
  1. Add the replace config of ember-cli-build to yours.
  2. Replace baseURL with rootURL in /config/environment.js.
  3. Configure router to use rootURL, as seen in router.js
  4. Update your app/index.html as per app-index.html below, such that you just append @@ in place of assets. This will be used as the replace instruction when compiling. For some reason regex doesn't work as expected.
@ivanvanderbyl
ivanvanderbyl / salmon-salad.md
Last active March 11, 2016 03:20
Salmon, Avocado, Orzo salad

Salmon, Avocado, Orzo salad

Ingredients

  • 1 pound salmon
  • 2 avocados
  • Bunch of asparagus
  • Juice of 2 lemons (or 1 large lemon)
  • Small amount of fresh dill (finely chopped)
  • Salt + Pepper
  • Olive oil
class EmberController < ApplicationController
def app
content = bootstrap_index(params[:revision])
render html: content.html_safe
end
private
def project_name
'dashboard'
@ivanvanderbyl
ivanvanderbyl / component.js
Created December 13, 2015 05:58
A simple line chart using D3 Shape
import Ember from 'ember';
import DimensionsMixin from '../../mixins/dimensions';
import { line, catmullRom } from "d3-shape";
import { extent } from "d3-arrays";
import { time, linear } from "d3-scales";
const { computed, observer } = Ember;
export default Ember.Component.extend(DimensionsMixin, {
@ivanvanderbyl
ivanvanderbyl / dimensions-mixin.js
Created December 13, 2015 04:50
Mixin for calculating dimensions of a component for use with d3 charts
import Ember from 'ember';
const { run: { next }} = Ember;
export default Ember.Mixin.create({
/**
* Internal for checking if we have a rendering context. If this is true
* the component have been rendered and we're in the next run loop step.
*
* @type {Boolean}
@ivanvanderbyl
ivanvanderbyl / application.controller.js
Created December 8, 2015 06:24
ember-component-inverse-template-dropdown-example
import Ember from 'ember';
export default Ember.Controller.extend({
});
import computedStyle from 'ember-computed-style';
export default Ember.Component.extend({
style: computedStyle('backgroundStyle'),
backgroundStyle: {
backgroundColor: "red",
},
attributeBindings: ['style'],
@ivanvanderbyl
ivanvanderbyl / application.controller.js
Last active December 8, 2015 03:07
ember-computed-style-demo
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Computed Style demo'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@ivanvanderbyl
ivanvanderbyl / components-my-counter.js
Created August 4, 2015 03:16
Data Down, Actions Up example
export default Ember.Component.extend({
count: 0,
actions: {
incrementCount: function() {
this.set('count', this.get('count') + 1);
if(this.attrs['on-change']) {
this.attrs['on-change'](this.get('count'));
}
}