Skip to content

Instantly share code, notes, and snippets.

View blimmer's full-sized avatar

Ben Limmer blimmer

View GitHub Profile
@blimmer
blimmer / foo_for_caching.rb
Created September 27, 2017 15:04
Rails Issue 30680 Workaround
# This class exists to make the caching of Foo objects more efficient.
# Marshaling full activerecord objects is expensive, especially in Rails 5
# because of this bug: https://github.com/rails/rails/issues/30680
# This simple ruby class selects a very small subset of parameters needed
# for common operations on these objects. It also acts like Foo, by
# passing attributes through to an in-memory Foo model.
class FooForCaching
attr_accessor :attributes
# This is a list of attributes we want to save in cache
@blimmer
blimmer / components.user-info.js
Created August 9, 2017 01:45
wip multipage validations
import Ember from 'ember';
import { validator, buildValidations } from 'ember-cp-validations';
import { userInfoValidations } from '../models/order';
const Validations = buildValidations(userInfoValidations);
export default Ember.Component.extend(Validations, {
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
yarn install v0.24.6
verbose 0.335 Checking for configuration file "/Users/blimmer/code/ember-cli-example-app-for-github/.npmrc".
verbose 0.335 Checking for configuration file "/Users/blimmer/.npmrc".
verbose 0.336 Found configuration file "/Users/blimmer/.npmrc".
verbose 0.337 Checking for configuration file "/Users/blimmer/.nvm/versions/node/v4.8.2/.npmrc".
verbose 0.337 Checking for configuration file "/Users/blimmer/code/ember-cli-example-app-for-github/.npmrc".
verbose 0.337 Checking for configuration file "/Users/blimmer/code/.npmrc".
verbose 0.337 Checking for configuration file "/Users/blimmer/.npmrc".
verbose 0.337 Found configuration file "/Users/blimmer/.npmrc".
verbose 0.337 Checking for configuration file "/Users/.npmrc".

Keybase proof

I hereby claim:

  • I am blimmer on github.
  • I am blimmer (https://keybase.io/blimmer) on keybase.
  • I have a public key whose fingerprint is 6819 6C90 F3C1 FA3D 0B38 E1C4 5F24 4531 0F92 F1EA

To claim this, I am signing this object:

@blimmer
blimmer / components.bad-focusable.js
Last active April 24, 2017 16:47
ember-component-focus bug
import Ember from 'ember';
import FocusableComponent from 'ember-component-focus/mixins/focusable-component';
export default Ember.Component.extend(FocusableComponent, {
focusNode: 'button:first', // not a valid selector!
didInsertElement() {
this._super(...arguments);
this.focus();
}
});
@blimmer
blimmer / components.my-component.js
Created April 19, 2017 19:30
yield all the things (hash)
import Ember from 'ember';
export default Ember.Component.extend({
myAction1() { alert('action 1!'); },
myAction2() { alert('action 2!'); }
});
import Ember from 'ember';
export default Ember.Component.extend({
myAction() {
alert('hi!')
}
});
import Ember from 'ember';
export default Ember.Component.extend({
myProperty: 'hi!'
});