Skip to content

Instantly share code, notes, and snippets.

@BruceL33t
BruceL33t / webpack.config.js
Created November 29, 2018 19:12
Resolve modules which have been added using `npm link` or `yarn link`
const fs = require('fs')
const path = require('path')
// absolute paths to all symlinked modules inside `nodeModulesPath`
// adapted from https://github.com/webpack/webpack/issues/811#issuecomment-405199263
module.exports = function findLinkedModules(nodeModulesPath) {
const modules = []
fs.readdirSync(nodeModulesPath).forEach(dirname => {
const modulePath = path.resolve(nodeModulesPath, dirname)
@BruceL33t
BruceL33t / mod.rs
Created September 20, 2017 23:46 — forked from mhallin/mod.rs
R2D2, Diesel, Postgres, and Juniper
pub struct Ctx {
pub db: request::PooledConnection,
}
impl Context for Ctx {}
pub fn context_factory(req: &mut Request) -> Ctx {
Ctx {
db: request::get_db(req),
}
<template>
<style>
.active a { color: red; font-weight: bold; }
</style>
<ul>
<li >
<a href="#viewmodel-with-subrouter/shared-parent/child-a">child a</a>
</li>
<li >
<a href="#viewmodel-with-subrouter/shared-parent/child-b">child b</a>
<template>
<style>
.active a { color: red; font-weight: bold; }
</style>
<ul>
<li >
<a href="#viewmodel-with-subrouter/shared-parent/child-a">child a</a>
</li>
<li >
<a href="#viewmodel-with-subrouter/shared-parent/child-b">child b</a>
<template>
<router-view layout-view="default.html" layout-view-model="default"></router-view>
</template>
<template>
<!--<ul>
<li><a href="#shared-parent/child-a">#shared-parent/child-a</a></li>
<li><a href="#shared-parent/child-b">#shared-parent/child-b</a></li>
<li><a href="#shared-parent2/child-a">#shared-parent2/child-a</a></li>
<li><a href="#shared-parent2/child-b">#shared-parent2/child-b</a></li>
</ul>-->
<style>
.active a { color: red; font-weight: bold; }
</style>
@BruceL33t
BruceL33t / app.html
Last active February 24, 2017 13:28 — forked from AshleyGrant/app.html
Grouped and Sorted Array Using a Value Converter
<template>
<require from="./grouped-sort"></require>
<table>
<template repeat.for="[group, items] of myArray2 | groupedSort">
<tr>
<td>
${group}
</td>
</tr>
<tr repeat.for="item of items">
<template>
<p>Parent App</p>
<require from="./child-app"></require>
<child-app main.bind="main1"></child-app>
<child-app main.bind="main2"></child-app>
</template>
@BruceL33t
BruceL33t / app-state.js
Last active March 29, 2016 22:02 — forked from jdanyow/app.html
Aurelia Gist
import { NodeModel } from './node-model';
let instance = null;
export default class AppState {
nodes = [];
visibleNodes = [];
constructor() {
if(!instance) {