Skip to content

Instantly share code, notes, and snippets.

Sylwia sylwiaeb

  • The Internet
Block or report user

Report or block sylwiaeb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View controllers.application.js
import Ember from 'ember';
import { computed } from '@ember/object';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View components.my-slider-item.js
import Ember from 'ember';
import { A } from '@ember/array';
export default Ember.Component.extend({
init() {
this._super(...arguments);
//this.get('registerItem')(this);
}
View components.blank-template.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: ''
});
View components.ember-input-wrapper.js
import Ember from 'ember';
export default Ember.Component.extend({
});
@sylwiaeb
sylwiaeb / random-string
Created May 16, 2018
Generate a random string with limit in JavaScript
View random-string
const generateString = (limit) => {
return new Date().getTime().toString().repeat(limit).substring(0, limit);
};
generateString(10); // 1526477455
@sylwiaeb
sylwiaeb / route-test.js
Created Apr 16, 2018 — forked from benbabics/route-test.js
Ember Mock Service
View route-test.js
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
let mockSession = Ember.Service.extend({
isAuthenticated: true,
currentUser: Ember.computed('isAuthenticated', function() {
return Ember.RSVP.Promise(function(resolve) {
resolve( Ember.Object.create({ accounts: [] }) );
});
})
View mirage-tils.org

Version: ^0.2.0-beta.5

How can I check the serialized version of a model?

server.get('api/employee's, function(schema, request) {
  employee = schema.employee.find(1);
  this.serializerOrRegistry.serialize(employee, request);

  return foo;
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
})
View components.lazy-options.js
import Ember from 'ember';
import PSOptionsComponent from 'ember-power-select/components/power-select/options';
const {
$,
assert,
get,
} = Ember;
View gist:c54a08701647614fd12f3727fba5478c
// converts '7-foo me, 30-boo me, 30-baz me' to '7,30,30'
function serialize(text) {
return text.replace(/[^\d,]/g, '');
}
// converts '7,30,30' to '7-foo me, 30-boo me, 30-baz me'
function humanize(text) {
const words = [
'-foo',
'-boo',
You can’t perform that action at this time.