Skip to content

Instantly share code, notes, and snippets.

@BowlingX
BowlingX / tree.ts
Created November 27, 2020 13:36
tree.ts
import _ from 'lodash'
export interface Node {
level: number
}
/**
* Creates a tree based on an materialized ordered path structure
* It's important the the `Nodes` are in the right order, otherwise it will fail.
* @param tree
@BowlingX
BowlingX / generate_json_tree.sql
Last active November 27, 2020 13:21
generate_json_tree.sql
drop type if exists node_tree cascade;
create type node_tree as
(
id int,
label varchar,
level int,
children jsonb
);
@BowlingX
BowlingX / MongoSessionManager.java
Last active August 29, 2015 14:06
JettyMongoDb Refresh
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// lib/handlebars/base.js
/*jshint eqnull:true*/
this.Handlebars = {};
(function(Handlebars) {
Handlebars.VERSION = "1.0.rc.2";
Handlebars.helpers = {};
@BowlingX
BowlingX / ember-data.js
Created January 27, 2013 10:46
Ember-JS
(function() {
window.DS = Ember.Namespace.create({
// this one goes to 11
CURRENT_API_REVISION: 11
});
})();
window.Forum = Ember.Application.create();
Forum.Router.map(function () {
this.resource('forum', function () {
this.route('detail', {path: '/:language/detail/:path'});
});
});
Forum.ForumDetailRoute = Ember.Route.extend({
setupController: function (cntr) {
@BowlingX
BowlingX / gist:4125301
Created November 21, 2012 15:06
assembly.sbt
import AssemblyKeys._
// apply Assembly settings
assemblySettings
// Set Main Class to run after (jar -jar yourJarFile)
mainClass in assembly := Some("com.yourcompany.FrontendLauncher")
// optional: No Test run in assemble
test in assembly := {}
@BowlingX
BowlingX / gist:4125278
Created November 21, 2012 15:02
remove about
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case PathList("javax", "servlet", xs @ _*) => (xs map {_.toLowerCase}) match {
case ("about.html" :: Nil) => MergeStrategy.discard
case _ => MergeStrategy.deduplicate
}
case x => old(x)
}
}
@BowlingX
BowlingX / gist:4125027
Created November 21, 2012 14:13
Simple Jetty Launcher
package com.yourcompany
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.webapp.WebAppContext
/**
* This describes our Main Entry point to launch YourApp
* Launches an embedded Jetty Server
*/
@BowlingX
BowlingX / build.sbt
Created November 21, 2012 13:22 — forked from meniku/build.sbt
project/plugins.sbt
========================================================
libraryDependencies <+= sbtVersion(v => v match {
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11"
case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
case x if (x.startsWith("0.12")) => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
})