Skip to content

Instantly share code, notes, and snippets.

View oliverbarnes's full-sized avatar

Oliver Azevedo Barnes oliverbarnes

View GitHub Profile
@oliverbarnes
oliverbarnes / snippets.md
Created January 12, 2024 23:59
Stuck with pavex getting started exercise

user_agent.rs

use pavex::http::header::{ToStrError, USER_AGENT};
use pavex::request::RequestHead;
use pavex::response::Response;

pub enum UserAgent {
	Unknown,
	Known(String),
}
Verifying my Blockstack ID is secured with the address 12TiEPhFGe5C9nKQwckDnzjV7jY2zMk7T6 https://explorer.blockstack.org/address/12TiEPhFGe5C9nKQwckDnzjV7jY2zMk7T6
@oliverbarnes
oliverbarnes / computed_property_with_promise_not_working.js
Last active August 29, 2015 14:26
Computed property with promise not working
import Ember from 'ember';
var PromiseObject = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
export default Ember.Component.extend({
proposal: null,
participant: null,
// previousSupport: [],
actions: {
@oliverbarnes
oliverbarnes / model-handling-models.js
Created August 7, 2015 16:10
Ember - example of models handling models
// app/templates/components/support-button.hbs
<button {{action 'toggleSupport' proposal session.me}}>
// app/components/support-button.js
export default Ember.Component.extend({
actions: {
toggleSupport: function(proposal, participant){
return proposal.toggleSupportBy(participant);
}
}
@oliverbarnes
oliverbarnes / undefined-cache-subject.js
Last active August 29, 2015 14:26
ember model unit test error
//tests/unit/models/proposal.js
/* jshint expr:true */
import {
describe,
describeModule,
it,
beforeEach,
afterEach
} from 'ember-mocha';
@oliverbarnes
oliverbarnes / errors-test.js
Last active August 29, 2015 14:17
test not loading
var get = Ember.get, set = Ember.set;
var models, env;
var responses, fakeServer;
module('integration/specs/errors', {
setup: function() {
fakeServer = stubServer();
responses = {
post_errors: {
@oliverbarnes
oliverbarnes / d3-test-error
Created December 25, 2014 21:54
Error testing d3 with capybara/poltergeist
Failure/Error: user = login_as_tenant
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
TypeError: 'undefined' is not an object (evaluating 'this.data[0].date')
TypeError: 'undefined' is not an object (evaluating 'this.data[0].date')
at http://127.0.0.1:53574/assets/application.js:24516
at http://127.0.0.1:53574/assets/application.js:24507 in UserShowTempChartSvg
@oliverbarnes
oliverbarnes / failure output
Created November 18, 2014 23:49
Timeout failure on ember-cli-mocha test
not ok 6 PhantomJS 1.9 - Posting an initiative before posting "before each" hook
---
message: >
timeout of 2000ms exceeded
Log: >
...
not ok 7 PhantomJS 1.9 - Posting an initiative when the initiative is valid "before each" hook
---
message: >
timeout of 2000ms exceeded
@oliverbarnes
oliverbarnes / .travis-for-ember-cli.yml
Last active August 29, 2015 14:04
travis.yml for ember cli app
language: node_js
node_js:
- "0.11"
before_script:
- npm install bower
- bower install
@oliverbarnes
oliverbarnes / ember-cli-bdd-tutorial-part-I
Last active August 29, 2015 14:04
Learning Behavior-Driven Development with Ember CLI - part I
This tutorial walks through [BDD](http://en.wikipedia.org/wiki/Behavior-driven_development)'ing a feature with [Ember CLI](http://iamstef.net/ember-cli/), [Mocha](http://visionmedia.github.io/mocha/) and [Chai](http://chaijs.com).
I'm writing it as I learn [Emberjs](http://emberjs.com), its way of doing things and its toolset, and try to adapt my usual workflow coming from Ruby. It's meant as an initial guide for the [RGSoC](http://railsgirlssummerofcode.org) [team](http://rghelsinki2014.tumblr.com) working on [Participate](https://github.com/oliverbarnes/participate-frontend). Hopefully this post will be helpful to others learning Ember as well, and even better, invite people to show how they're doing things themselves in the comments.
The feature I'll build here in baby-steps will be *Posting a New Initiative*. In Participate, a user can post proposals for civic initiatives, to which other users can then suggest changes, and then vote on.
This first installment will involve nothing but filling out a si