Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Florence ryanflorence

View GitHub Profile
View gist:b3cb84b3738d37106c6d
class App extends React.Component {
componentDidMount () {
history.listen((location) => {
this.props.dispatch({ type: 'ROUTE_CHANGE', location })
})
},
render () {
return (
View build.js
// this file is designed to freak you out
const fs = require('fs')
const path = require('path')
const hbs = require('handlebars')
const cheerio = require('cheerio')
!function main() {
return process.stdout.write(
template()(
templateLocals()))}()
View resolver_new-a0f3198604bf00a43082a4fccd8995e5325b521a.coffee
define ['require', 'ember'], (req, Ember) ->
underscore = Ember.String.underscore
Ember.DefaultResolver.extend
base: ''
# attempts to require the module from the AMD registry
resolve: (fullName) ->
@ryanflorence
ryanflorence / upgrade-bash.sh
Created Feb 7, 2014
update your bash on mac os x, because 3.2 is old
View upgrade-bash.sh
brew install bash
echo "/usr/local/bin/bash" | sudo tee -a /etc/shells
chsh -s /usr/local/bin/bash
View inherit-model.js
var Ember = require('ember');
Ember.Route.reopen({
model: function(params, transition) {
var match, name, sawParams, value;
for (var prop in params) {
if (prop === 'queryParams') { continue; }
if (match = prop.match(/^(.*)_id$/)) {
name = match[1];
View inherit-model.js
var Ember = require('ember');
Ember.Route.reopen({
model: function(params, transition) {
var match, name, sawParams, value;
for (var prop in params) {
if (prop === 'queryParams') { continue; }
if (match = prop.match(/^(.*)_id$/)) {
name = match[1];
View index.html
<!doctype html>
<meta charset="utf-8">
<link rel="stylesheet" href="bower_components/qunit/qunit/qunit.css">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/handlebars/handlebars.js"></script>
<script src="bower_components/ember/ember.js"></script>
View fake.hbs
{{#ic-tabs}}
{{#ic-tab}}
{{#ic-tab-label}}Foo{{/ic-tab-label}}
{{#ic-tab-content}}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
View setup.js
Function.prototype.compile = function() {
var template = this.toString().split('\n').slice(1,-1).join('\n') + '\n';
return Ember.Handlebars.compile(template);
}
/*******************************************************/
test('sets first tab found to active', function() {
expect(2);
var component = this.subject({
View tab-panel.js
import { Component, computed } from 'ember';
export default Component.extend({
tagName: 'ic-tab-panel',
attributeBindings: [
'role',
'aria-labeledby'
],