Skip to content

Instantly share code, notes, and snippets.

View jeffreybiles's full-sized avatar

Jeffrey Biles jeffreybiles

View GitHub Profile
@jeffreybiles
jeffreybiles / public_gist_test.coffee
Created August 5, 2012 20:36
testing public gists
publicGist = (test) ->
test = test + 1
@jeffreybiles
jeffreybiles / x=5.coffee
Created August 5, 2012 21:40
for a tutorial
x = 5
var x;
x = 5;
square = (x) -> x * x
var square;
square = function(x) {
return x * x;
};
@jeffreybiles
jeffreybiles / gist:53308b32db5abf5db412
Created April 7, 2015 22:11
hacky way to count number of CSS rules
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
var totalCount = 0
for (var i = 0; i < document.styleSheets.length; i++) {
totalCount += countSheet(document.styleSheets[i]);
@jeffreybiles
jeffreybiles / computed_properties.md
Created October 30, 2015 00:50 — forked from danielchappell/computed_properties.md
Computed Properties Best Practices

Computed Property Theory & Best Practices or Functional Programming in Ember or How I learned to stop worrying and love the Tomster.

In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it the same way you would any normal, static property. -- The Ember Guides

The Ember Object Model is the corner stone of Ember, and at the heart of the Object Model are computed properties.

The guides do a fine job giving need to know information on how to create and use computed properties and what to expect from the cacheing system they provide. However, I feel so much of the beauty that computed properties provide is lost in terse (but wonderful) documentation.

Quick..the basics!

import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@jeffreybiles
jeffreybiles / components.validated-field.js
Created August 11, 2016 20:29 — forked from poteto/controllers.application.js
ember-changeset-validations demo
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
validateProperty(changeset, property){
return changeset.validate(property);
}
}
});