Skip to content

Instantly share code, notes, and snippets.

@selvagsz
selvagsz / index.html
Last active December 18, 2015 14:18
A CodePen by Hugo Giraudel. Demo Flexbox 1
<ul class="flex-container">
<li class="flex-item item1">1</li>
<li class="flex-item item2">2</li>
<li class="flex-item item3">3</li>
<li class="flex-item item4">4</li>
<li class="flex-item item5">5</li>
<li class="flex-item item6">6</li>
</ul>
a{
cursor: pointer;
}
a:hover {
text-decoration: none;
}
a.active {
color: #e64d33;
font-size: 16px
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
.bar {
fill: steelblue;
}
a:hover {
text-decoration: none;
}
a.active {
color: maroon;
font-size: 18px;
}
var mergeItem = function(item){
if(Em.typeOf(item) === 'object') {
item = merge({}, item);
} else if(Em.typeOf(item) === 'array') {
item = mergeArray(item);
}
return item;
};
var mergeArray = function(arr) {
function ajax (url, options) {
return new Ember.RSVP.Promise(function (resolve, reject) {
options = options || {};
options.url = url;
options.success = function (data) {
Ember.run(null, resolve, data);
};
options.error = function (jqxhr, status, something) {
/* Put your CSS here */
html, body {
margin: 20px;
}
@selvagsz
selvagsz / unit-test-controller.js
Created May 1, 2014 14:18
Unit testing - emberjs
import {SomeModel} from 'some/path/to/somemodel';
moduleFor("controller:somecontroller", "My Query in subject", {
subject: function(options, factory) {
return factory.create({
content: SomeModel.create()
});
}
});
@selvagsz
selvagsz / router.js
Last active August 29, 2015 14:01
Nested Route Url without nesting templates
var get = Em.get;
App.Router.map(function() {
this.route('something');
this.route('somethingelse', {path: '/somethingelse/:foo_id/:bar_id/:baz_id'});
});
App.SomethingelseRoute = Em.Route.extend({
model: function(params) {
//fetch the model
// Extend Ember.Route to add support for sensible
// document.title integration.
Ember.Route.reopen({
// `titleToken` can either be a static string or a function
// that accepts a model object and returns a string (or array
// of strings if there are multiple tokens).
titleToken: null,