Skip to content

Instantly share code, notes, and snippets.

View pichsenmeister's full-sized avatar
one sparkle at a time

David Pichsenmeister pichsenmeister

one sparkle at a time
View GitHub Profile
@reywood
reywood / meteor-init-script
Last active July 27, 2017 18:05
SysVinit boot script for running a bundled Meteor app under Forever as a service. Should work with CentOS, Redhat, Amazon Linux, etc.
#!/bin/bash
#
# Service script for running a bundled Meteor application under Forever.
# Meteor settings JSON file should be in /etc/meteor/[YOUR APP NAME].json,
# and the METEOR_SETTINGS var below should be updated as appropriate.
#
# chkconfig: 345 80 20
# description: My node app
#
@pichsenmeister
pichsenmeister / reflection-import.scala
Last active December 20, 2015 17:18
scala reflection: import
import scala.reflect.runtime.universe._
@pichsenmeister
pichsenmeister / reflection-instantiation.scala
Last active February 16, 2017 03:04
scala reflection: create instance
def getObjectInstance(clsName: String): ModuleMirror = {
val mirror = runtimeMirror(getClass.getClassLoader)
val module = mirror.staticModule(clsName)
mirror.reflectModule(module).instance
}
def getClassInstance(clsName: String): Any = {
val mirror = runtimeMirror(getClass.getClassLoader)
val cls = mirror.classSymbol(Class.forName(clsName))
val module = cls.companionSymbol.asModule