Skip to content

Instantly share code, notes, and snippets.

@darylteo
darylteo / NinjectWebCommon.cs
Created July 5, 2014 08:04
Ninject injection into Signalr Hubs with ninject.mvc5.
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(Ascend.Core.Application.App_Start.NinjectWebCommon), "Start")]
[assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(Ascend.Core.Application.App_Start.NinjectWebCommon), "Stop")]
namespace Ascend.Core.Application.App_Start
{
using System;
using System.Linq;
using System.Web;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
2
3
5
7
11
13
17
19
23
29
repositories {
mavenCentral()
}
apply plugin:'java'
configurations {
metamodel
validator
processor
@darylteo
darylteo / build.gradle
Created March 30, 2014 09:51
Detecting if a dependency is valid in Gradle
def doesModuleExist(def notation) {
try {
def dep = project.dependencies.create(notation)
def conf = project.configurations.detachedConfiguration(dep)
// force resolution
def files = conf.files
} catch (Exception e) {
e.printStackTrace()
return false
@darylteo
darylteo / update.sql
Created March 6, 2014 07:01
Rebuild Umbraco's level/node structure after modifying parentids. Needs a better recursive union. This example only works with content types specifically.
WITH CT AS (
SELECT *
FROM umbracoNode
WHERE (nodeObjectType = 'A2CB7800-F571-4787-9638-BC48539A0EFB')
),
L1 AS (
SELECT *, 1 'NewLevel', CAST(parentID as varchar) + ',' + CAST(id as varchar) 'NewPath'
FROM CT
WHERE parentID = -1
), L2 AS (
<div class="datagrid_hack"></div>
<script>
(function ($) {
// check so that this code only fires once.
if ($._datagridHack) {
return;
}
$._datagridHack = function () {
var root = $('.datagrid_hack');
@darylteo
darylteo / build.gradle
Last active August 29, 2015 13:56
Working with a task created by maven-publish pulication.
apply plugin: 'java'
apply plugin: 'maven-publish'
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
task dummy << {
@darylteo
darylteo / build.gradle
Created January 4, 2014 12:41
Getting an Antlr task going in gradle.
repositories {
mavenCentral()
mavenLocal()
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply from: 'gradle/sonatype.gradle'
group = 'com.darylteo'
@darylteo
darylteo / javadoc.gradle
Last active December 1, 2016 14:53
Add external sources to javadoc.
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'net.spy', name:'spymemcached', version: '2.10.3'
}
@darylteo
darylteo / sonatype.gradle
Last active December 28, 2015 13:49
Sonatype Configuration for Gradle
apply plugin: 'maven'
apply plugin: 'signing'
project.afterEvaluate {
def release = !project.version.endsWith('-SNAPSHOT')
def sonatypeUsername = project.hasProperty('sonatypeUsername') ? project.sonatypeUsername : '';
def sonatypePassword = project.hasProperty('sonatypePassword') ? project.sonatypePassword: '';
configurations {