Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Working from home

Alex Kanunnikov lifeart

:octocat:
Working from home
View GitHub Profile
@lifeart
lifeart / index.js
Last active Sep 23, 2021
sass-hook
View index.js
const stew = require('broccoli-stew');
const themeName = process.env.EMBER_THEME || 'default';
module.exports = {
_registers: [],
setupPreprocessorRegistry(type, registry, isFinal = false) {
if (themeName === 'default') {
return;
View controllers.application\.js
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 Sep 5, 2021
Ember AgGrid integration
View ag-iterator.hbs
{{#each (get @box 'agGridIterator') key="id" as |node|}}
{{#-in-element node.node}}
{{yield node}}
{{/-in-element}}
{{/each}}
View handlebars.json
{
"each autocomplete": {
"prefix": "{{#each",
"body": [
"{{#each ${1:items} as |${2:item}|}}",
" ${3:content}",
"{{/each"
],
"description": "each autocomplete"
},
@lifeart
lifeart / index.js
Last active Aug 27, 2021
Create Ember app inside ShadowRoot node
View index.js
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 Aug 26, 2021
Minimal Ember 3.28 app with runtime-defined components
View ember-cli-build.js
'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 Aug 26, 2021
generic ember render tree capture
View index.js
let EmberCore;
try {
EmberCore = requireModule('ember')['default'];
} catch {
EmberCore = window.Ember;
}
const isEmberApp = (el) => el._debugContainerKey === 'application:main';
const apps = Object.values(EmberCore.Application.NAMESPACES).filter(isEmberApp);
@lifeart
lifeart / example.js
Created Jul 14, 2021
glimmer inline components
View example.js
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 Sep 8, 2021
OSS readme.md
View readme.md

Application Name Gitter

Philosopher’s stone, logo of PostCSS

This is fancy application or library description.