Skip to content

Instantly share code, notes, and snippets.

View ivanvanderbyl's full-sized avatar
🏔️

Ivan Vanderbyl ivanvanderbyl

🏔️
View GitHub Profile
@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 computedStyle from 'ember-computed-style';
export default Ember.Component.extend({
style: computedStyle('backgroundStyle'),
backgroundStyle: {
backgroundColor: "red",
},
attributeBindings: ['style'],
@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({
});
@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 / 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, {
class EmberController < ApplicationController
def app
content = bootstrap_index(params[:revision])
render html: content.html_safe
end
private
def project_name
'dashboard'
@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
@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.
class EmberController < ApplicationController
def app
content = bootstrap_index(params[:revision])
render html: content.html_safe
end
private
def project_name
'flood-dashboard'
@ivanvanderbyl
ivanvanderbyl / largest-triangle-three-bucket-sample.js
Created December 10, 2016 01:14
Downsamples a dataset to threshold while maintaining the visual characteristics
/*
* The MIT License
Copyright (c) 2013 by Sveinn Steinarsson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: