Skip to content

Instantly share code, notes, and snippets.

View aelbore's full-sized avatar

Jay aelbore

View GitHub Profile
@znck
znck / Vue component module
Last active November 26, 2018 01:18
Example for `rollup-plugin-vue`
Create a module for vue component.
@maddijoyce
maddijoyce / hookLoader.js
Created June 9, 2016 04:39
Istanbul hook loader to be used programatically
import { hook, Instrumenter } from 'babel-istanbul';
import { clone } from 'lodash';
let instrumenter = null;
const baselineCoverage = {};
export function getCoverageObject() {
global.coverage = global.coverage || {};
return global.coverage;
}
@jkga
jkga / app-style.js
Created June 21, 2018 15:52
Adding style inside Vue components' template without using vue-loader
// app-style.js
// adding <style></style> directly inside template will result in error or empty element which
// this component is trying to address
// this will allow you to dynamically insert css inside Vue template without the use of vue loader
// or if you do not want to use .vue extension at all
// however it doesnt really apply scope css (for now).
export default {
name: 'app-style',
data: function(){
return {
@ebidel
ebidel / object-observe-proxy-polyfill.js
Last active July 29, 2021 04:08
Object.observe() polyfill using ES6 Proxies (POC)
// An `Object.observe()` "polyfill" using ES6 Proxies.
//
// Current `Object.observe()` polyfills [1] rely on polling
// to watch for property changes. Proxies can do one better by
// observing property changes to an object without the need for
// polling.
//
// Known limitations of this technique:
// 1. the call signature of `Object.observe()` will return the proxy
// object. The original object needs to be overwritten with this return value.
@tbranyen
tbranyen / _setup.sh
Created May 29, 2017 04:03
Web Components <3 JSDOM
npm i jsdom-wc@11.0.0-alpha-1
@impaler
impaler / compile.js
Last active July 1, 2022 00:54
Compile webpack with typescript in memory
// based on code from https://stackoverflow.com/questions/38779924/compiling-webpack-in-memory-but-resolving-to-node-modules-on-disk
import * as webpack from 'webpack'
import * as MemoryFileSystem from 'memory-fs'
import * as path from 'path'
import * as fs from 'fs'
import * as promisify from 'util.promisify'
const memFs = new MemoryFileSystem()
const statOrig = memFs.stat.bind(memFs)
import {
Directive, TemplateRef, Input, ChangeDetectorRef, ViewContainerRef,
IterableDiffers, OnChanges, SimpleChanges, SimpleChange
} from '@angular/core';
import { NgFor } from "@angular/common";
import { NgForRow } from "@angular/common/src/directives/ng_for";
@Directive({
selector: '[ngFor][ngForIn]'
})
@jb55
jb55 / default.nix
Last active July 30, 2023 21:45
deploy dotnet core apps on nixos
{ stdenv, lib, bash, callPackage, writeText, makeWrapper, writeScript, dotnet-sdk,
patchelf, libunwind, coreclr, libuuid, curl, zlib, icu }:
let
config = "Staging";
project = "RazorCx.Api";
target = "linux-x64";
rpath = stdenv.lib.makeLibraryPath [ libunwind coreclr libuuid stdenv.cc.cc curl zlib icu ];
@zeusdeux
zeusdeux / ES5vsES6.js
Last active September 6, 2023 15:03
ES5 inheritance vs ES6 inheritance
/* ES6/ES2015 classes */
class A {
constructor() {
this.a = 10
}
print() {
console.log(this.a, this.b)
}
}