Skip to content

Instantly share code, notes, and snippets.

View Bestra's full-sized avatar
😃

Chris Westra Bestra

😃
  • GitHub
  • Columbus, OH
  • 23:58 (UTC -05:00)
  • X @_Bestra
View GitHub Profile
@Bestra
Bestra / index.html
Last active December 17, 2015 01:30 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.node text {
font: 10px sans-serif;
pointer-events: none;
@Bestra
Bestra / README.md
Last active December 22, 2015 05:58 — forked from mbostock/.block

By adding transitions, we can more easily follow the elements as they are entered, updated and exited. Separate transitions are defined for each of the three states.

Note that no transition is applied to the merged enter + update selection; this is because it would supersede the transition already scheduled on entering and updating elements. It's possible to schedule concurrent elements by using transition.transition or by setting transition.id, but it's simpler here to only transition the x-position on update; for entering elements, the x-position is assigned statically.

Want to read more? Try these tutorials:

@Bestra
Bestra / README.md
Created February 4, 2014 11:55 — forked from mbostock/.block

This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.

test 'Paper hasMany tasks (async)', ->
stop()
paperPromise = Ember.run =>
task1 = @store().createRecord 'task', type: 'MessageTask', title: 'A message', isMetaData: false
task2 = @store().createRecord 'task', type: 'TechCheckTask', title: 'some task',isMetaData: true
paper = @store().createRecord 'paper',
title: 'some really long title'
shortTitle: 'test short title'
paper.get('tasks').then (tasks) ->
tasks.pushObjects [task1, task2]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Showing Flash-style Messages in Ember

Flash messages are ubiquitous on the web. Update your credit card info on any given site and you'll see the friendly "Your information has been updated" message when the page reloads. Having a consitent notification area on the page that users can glean status and errors from can also be very convenient from a development standpoint, for better or worse. The flash in a Rails application acts like a global hash that is cleared out after each request. It's a pattern that's not too difficult to mimic in Ember.

We'll need a few pieces in our app in order to display the flash.

  • A place to store the flash
  • A way to clear the flash after transitions
  • A place to display the flash message(s)
@Bestra
Bestra / gist:68fd3add3865947ea66f
Created January 29, 2015 14:44
A Ruby FFI Odyssey
http://blog.skylight.io/bending-the-curve-writing-safe-fast-native-gems-with-rust/
http://stackoverflow.com/questions/24145823/rust-ffi-c-string-handling
https://siciarz.net/24-days-of-rust-calling-rust-from-other-languages/
@Bestra
Bestra / app.css
Last active August 29, 2015 14:15
Contacts App Mockups
html {
box-sizing: border-box;
font-family: "Helvetica Neue", Helvetica, arial, sans-serif;
}
*, *:before, *:after {
box-sizing: inherit;
margin: 0; padding: 0;
}
h1 {
@Bestra
Bestra / components_user_vacation-list_component.js
Last active January 4, 2016 19:59
Component Integration Test blog post snippets
export default Ember.Component.extend({
user: null,
actions: {
createVacation(startDate, endDate) {
this.store.createRecord('vacation', {user: this.get('user'), startDate, endDate});
}
}
});
@Bestra
Bestra / application.controller.js
Last active November 6, 2024 01:10
Cat Trader
import Ember from 'ember';
export default Ember.Controller.extend({
websocket: Ember.inject.service(),
listener: Ember.inject.service('websocket-listener'),
appName:'Cat Trader',
users: Ember.computed.alias('model'),