Skip to content

Instantly share code, notes, and snippets.

🤓
Code it!

Alex Kanunnikov lifeart

🤓
Code it!
Block or report user

Report or block lifeart

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 application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View components.ember-iframe.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'iframe',
attributeBindings: ['sandbox','src'],
src: Ember.computed(function(){
return '';
}),
sandbox: 'allow-scripts allow-same-origin allow-popups allow-top-navigation allow-forms',
didRender() {
const doc = this.$()[0].contentDocument || this.$()[0].contentWindow.document;
View application.js
import DS from 'ember-data';
import Ember from 'ember';
const {get, A, isArray} = Ember;
export default DS.JSONAPIAdapter.extend({
host: 'http://mysite.com/data',
pathMap: {
'query:partner-video': 'wm2/get_videos',
'query:partner-payment': 'wm2/get_payments',
'findAll:partner-video': 'wm2/get_videos',
'updateRecord:partner-video': 'wm2/set_file_info',
@lifeart
lifeart / model.js
Created Jul 4, 2017
Application model serializer
View model.js
import DS from 'ember-data';
import ClubSerializer from '../serializers/application';
export default ClubSerializer.extend({
extractAttributes(modelClass, resourceHash) {
var attributes = {};
resourceHash['origin'] = resourceHash.video_id;
resourceHash['file-name'] = resourceHash.file;
resourceHash['thumbnail-offset'] = resourceHash.img;
resourceHash['duration'] = resourceHash.len_val;
@lifeart
lifeart / getargs.js
Created Jul 14, 2017
Get fn args name
View getargs.js
function getArgs(fn) {
const str = fn.toString();
return str
.slice(str.indexOf('(')+1,str.indexOf(')'))
.split(',')
.map(e=>e.trim());
};
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
a: 1,
b: 2,
c: 3,
d: Ember.computed('a','b','c',function(){
return this.get('a')+this.get('b')+this.get('c');
})
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle1',
a: 3,
b: 4,
c: 5,
d: Ember.computed('a','b','c', function(){
return this.get('a') + this.get('b') + this.get('c');
}),
View components.camel-case-to-undersocre-converter.js
import Ember from 'ember';
export default Ember.Component.extend({
input: '',
output: "",
spaceReplacement: "{+}",
newLine: "\n",
inputObserver: Ember.observer('input', function() {
const input = this.get('input');
const newLine = this.get('newLine');
@lifeart
lifeart / pure.js
Last active Aug 17, 2017
PureQML formatter
View pure.js
function parent(propName) {
return function() {
if (!propName) {
return `parent`;
}
return `parent.${propName}`;
}
}
function isSignal(nodeValue) {
You can’t perform that action at this time.