Skip to content

Instantly share code, notes, and snippets.

View code0100fun's full-sized avatar
🏠
Working from home

Chase McCarthy code0100fun

🏠
Working from home
View GitHub Profile
@code0100fun
code0100fun / application.controller.js
Last active September 30, 2015 12:28
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
mustaches:'mustaches'
});
@code0100fun
code0100fun / application.controller.js
Last active September 30, 2015 00:17
Computed 'get' bug
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
wrapped: false,
wrapper: Ember.computed('wrapped', {
get() {
return this.get('wrapped');
},
set(key,value) {
@code0100fun
code0100fun / app_controllers_sign-in.js
Created June 8, 2015 20:02
Ember Simple AUth + Ember CLI Mirage
// app/controllers/sign-in.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
signIn(){
this.set('errors', null);
var params = { identification: this.get('email'), password: this.get('password') };
// Redirects to index route on success (configurable in config/environment.js)
this.get('session').authenticate('simple-auth-authenticator:oauth2-password-grant', params);
@code0100fun
code0100fun / tests_acceptance_foo-test.js
Last active July 9, 2018 01:05
Ember CLI QUnit text content helpers
// tests/acceptance/foo-test.js
// Assert that text should be found
assert.hasText('Not Found'); // Error: Could not find text "Not Found" on the page
// Provide custom message
assert.hasText('Not Found', 'Expected to find "Not Found"'); // Error: Expected to find "Not Found"
// Find any number of elements containing the query text
text('Found'); // [<div>Found</div>, <input value="Found">]
@code0100fun
code0100fun / component_with_optional_block.handlebars
Created March 30, 2015 14:21
Ember component with optional block
<!-- app/templates/*.hbs -->
{{#if template}}
{{yield}}
{{else}}
{{defaultContent}}
{{/if}}
@code0100fun
code0100fun / ember_cli_qunit_custom_assertion.js
Created March 30, 2015 13:50
Using custom QUnit assertions with Ember CLI
// tests/test-helper.js
import QUnit from 'qunit';
QUnit.assert.trimEq = function(actual, expected) {
var trimActual = actual.replace(/^\s+|\s+$/g,'');
this.equal(trimActual, expected);
};
// tests/unit/components/*.js
assert.trimEq(this.$().text(), 'foo');
@code0100fun
code0100fun / ember_cli_firebase.md
Created March 20, 2015 01:09
Ember CLI Firebase setup

Firebase example

Init

$ ember new chat
$ cd chat/
$ npm install --save emberfire
$ npm install -g firebase-tools
$ firebase init
Firebase example
## Init
```
$ ember new chat
$ cd chat/
$ npm install --save emberfire
$ npm install -g firebase-tools
$ firebase init
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@code0100fun
code0100fun / ruby-llvm-osx.md
Created May 14, 2014 14:15
Install ruby-llvm gem on OS X
1. Pull the repo and bundle
$ git clone git@github.com:code0100fun/ruby-llvm.git
$ cd ruby-llvm/
$ bundle install
2. Create a symbolic link to llvm-config in your PATH