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
@lifeart
lifeart / glimmer.js
Created Dec 9, 2019
GlimmerVueHooks
View glimmer.js
import { set } from '@ember/object';
function store(initValue) {
let context = null;
let propName = null;
let getter = {
get value() {
retun initValue
}
}
@lifeart
lifeart / ability.js
Created Oct 31, 2019
Simple Roles Management
View ability.js
import { get } from '@ember/object';
const permissions = EmberObject.create({
study: {
see: ['STUDY_MANAGER', 'DATA_ENTRY', 'ADMIN'],
create: ['DATA_ENTRY', 'ADMIN'],
edit: ['STUDY_DIRECTOR', 'DATA_ENTRY', 'ADMIN'],
}
})
View components.my-component.js
import Ember from 'ember';
function vueComponentWrapper(
Component,
{ container, data = {}}
) {
const mountNode = document.createElement("div");
container.appendChild(mountNode);
var ComponentClass = Vue.extend(Component);
var instance = new ComponentClass({
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
mutate() {
this.set('items', [1,2,3]);
}
}
});
View controllers.application.js
import Ember from 'ember';
function useState(defaultValue, updateValue) {
}
export default Ember.Controller.extend({
init() {
this._super(...arguments);
@lifeart
lifeart / components.my-component.js
Last active Sep 21, 2019
Ember Vue Component API
View components.my-component.js
import vue from '../utils/vue';
export default vue({
data() {
return {
name: 1,
items: [],
james: {
name: 12
}
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
});
@lifeart
lifeart / ref.js
Last active Sep 17, 2019
JS references
View ref.js
const contextMap = new WeakMap();
function defaultContext() {
return window;
}
function resolveItemAndContext(ctx, item) {
if (item === undefined && typeof ctx === 'string') {
item = ctx;
ctx = defaultContext();
You can’t perform that action at this time.