Skip to content

Instantly share code, notes, and snippets.

View apolaskey's full-sized avatar
⌨️
Making greatness!

Andrew Polaskey apolaskey

⌨️
Making greatness!
View GitHub Profile
@apolaskey
apolaskey / build-all-projects.js
Created November 15, 2020 14:50
Build All Angular Projects
// Imports
const fs = require('fs'), spawn = require('child_process').spawn;
// Filter for projects to not build with this
const filter = ['e2e'];
// Amount of projects to build async.
const batch = 3;
@apolaskey
apolaskey / fat.jar.kt
Created January 5, 2020 03:56
Gradle Kotlin Fat Jar with Main
// Put main in companion object of said class
/*
class App {
companion object {
@JvmStatic
fun main(args: Array<String>) {
System.out.println("Hello")
}
}
}
@apolaskey
apolaskey / FindAllMethodsWith.java
Last active April 22, 2016 03:34
Find all Methods with Annotation
public static List<Method> getMethodsAnnotatedWith(final Class<?> type, final Class<? extends Annotation> annotation) {
final List<Method> methods = new ArrayList<>();
Class<?> klass = type;
while (klass != Object.class) {
final List<Method> allMethods = new ArrayList<>(Arrays.asList(klass.getDeclaredMethods()));
allMethods.stream()
.filter(method -> method.isAnnotationPresent(annotation))
.forEach(methods::add);
klass = klass.getSuperclass();
}
@apolaskey
apolaskey / ninject-cheatsheet.cs
Last active September 26, 2023 21:24
Ninject Cheatsheet
// Backup from https://lukewickstead.wordpress.com/2013/01/18/ninject-cheat-sheet/
// **** DETERMINING WHICH CONSTRUCTOR TO USE ****
// The main DI pattern is Constructor Injection
// A known constructor parameter is one which has been explicitly bound
// An unknown constructor parameter is one which has not been explicitly bound even if it has a resolvable constructor the following order defines which constructor is used
// 1. User defined costructor marked with [Inject] attribute
// 2. The constructor with the most known bound parameters.
// 3. The default parameterless constructor
// **** PROPERTY / METHOD INJECTION
@apolaskey
apolaskey / htmlremover.cs
Created July 10, 2012 18:26
Regex to Remove HTML Tags
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@using System.Text.RegularExpressions
@functions {
String HtmlRemover(string html)
{
//Source: http://stackoverflow.com/questions/307013/how-do-i-filter-all-html-tags-except-a-certain-whitelist