Skip to content

Instantly share code, notes, and snippets.

View lifeart's full-sized avatar
🐹
Working from home

Alex Kanunnikov lifeart

🐹
Working from home
View GitHub Profile
@lifeart
lifeart / controllers.application\.js
Last active September 5, 2021 20:30
New Twiddle
import Controller from "@ember/controller";
import agGrid from "agGrid";
import { schedule } from "@ember/runloop";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
function createAgGridWrapper(component) {
class Box {
@tracked
@lifeart
lifeart / ag-iterator.hbs
Last active February 18, 2023 09:11
Ember AgGrid integration | ag-grid
{{#each (get @box 'agGridIterator') key="id" as |node|}}
{{#-in-element node.node}}
{{yield node}}
{{/-in-element}}
{{/each}}
{
"each autocomplete": {
"prefix": "{{#each",
"body": [
"{{#each ${1:items} as |${2:item}|}}",
" ${3:content}",
"{{/each"
],
"description": "each autocomplete"
},
@lifeart
lifeart / index.js
Last active August 27, 2021 18:58
Create Ember app inside ShadowRoot node
class MyApp extends HTMLElement {
constructor() {
super();
this.shadow = this.attachShadow({ mode: 'open' });
this.shadow.classList = {
contains: () => { return false }
};
}
connectedCallback() {
const node = document.createElement('div');
@lifeart
lifeart / ember-cli-build.js
Last active January 28, 2022 18:57
Minimal Ember 3.28 app with runtime-defined components
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function (defaults) {
let app = new EmberApp(defaults, {});
// we need to add emebr-template-compiler into runtime
app.import('node_modules/ember-source/dist/ember-template-compiler.js');
@lifeart
lifeart / index.js
Last active March 27, 2022 13:52
generic ember render tree capture
let EmberCore;
try {
EmberCore = requireModule('ember')['default'];
} catch {
EmberCore = window.Ember;
}
const keys = ['application','engine'];
//const isEmberApp = (el) => el._debugContainerKey && keys.includes(el._debugContainerKey.split(':')[0]);
@lifeart
lifeart / example.js
Created July 14, 2021 14:22
glimmer inline components
import SecondComponent from 'foo/bar';
function MyComponent(args) { return { a: 1, b: 2, c: args.e } }
function hasHelperManagerFor() {
return true;
}
function hasComponentManagerFor() {
@lifeart
lifeart / readme.md
Last active September 8, 2021 13:59
OSS readme.md

Application Name Gitter

Philosopher’s stone, logo of PostCSS

This is fancy application or library description.

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
class ReactivePart {
constructor(placeholder) {
this.value = placeholder.replace('{{', '').replace('}}','');
this.placeholder = placeholder;
}
get isEditable() {
return this.placeholder.startsWith('{{');