Skip to content

Instantly share code, notes, and snippets.

View schmitch's full-sized avatar

Schmitt Christian schmitch

View GitHub Profile
@schmitch
schmitch / Registration.scala
Created September 24, 2013 08:20
Securesocial Registration Disabler Gist
/**
* Copyright 2012 Jorge Aliss (jaliss at gmail dot com) - twitter: @jaliss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@schmitch
schmitch / gist:6685491
Created September 24, 2013 14:20
Error
[info] C:\Users\Christian\workspace\envisia\rsflex\target\windows\RSFlex.wix(1757) : error CNDL0027 : The Shortcut/@Name attr
ibute's value, '\application.conf', is not a valid long name because it contains illegal characters. Legal long names contai
n no more than 260 characters and must contain at least one non-period character. Any character except for the follow may be
used: \ ? | > < : / * ".
[info] C:\Users\Christian\workspace\envisia\rsflex\target\windows\RSFlex.wix(1757) : error CNDL0027 : The Shortcut/@Name attr
ibute's value, '\elasticsearch.conf', is not a valid long name because it contains illegal characters. Legal long names cont
ain no more than 260 characters and must contain at least one non-period character. Any character except for the follow may
be used: \ ? | > < : / * ".
[info] C:\Users\Christian\workspace\envisia\rsflex\target\windows\RSFlex.wix(1757) : error CNDL0027 : The Shortcut/@Name attr
ibute's value, '\messages', is not a valid long name because it contains illegal characte
$q.when(next).
then(function() {
if (next) {
var locals = angular.extend({}, next.resolve);
angular.forEach(locals, function(value, key) {
locals[key] = angular.isString(value) ?
$injector.get(value) : $injector.invoke(value, null, null, key);
});
return $q.all(locals);
// TLS config, do not set InsecureSkipVerify to true in production
// since it will accept all certificates
config := &tls.Config{
InsecureSkipVerify: false,
ServerName: host,
}
c, err := smtp.Dial(server)
if err != nil {
log.Fatal(err)
import scala.math.BigDecimal.RoundingMode
object Demo extends App {
val d: Double = 1.0 / 3 * 3 + 0.01
val bd1 = BigDecimal(1.0) / BigDecimal(3) * BigDecimal(3) + BigDecimal(0.01)
println("d: " + d)
println("bd1: " + bd1.setScale(2, RoundingMode.HALF_DOWN))
}
object Demo {
def simple = {
SimpleDBIO[Long]{d =>
val lobj = d.connection.unwrap(classOf[PGConnection]).getLargeObjectAPI
val oid = lobj.createLO(LargeObjectManager.READWRITE)
val lo = lobj.open(oid, LargeObjectManager.WRITE)
val out = lo.getOutputStream // Use this outputstream to write directly to the database
// Write to the outputstream, call close
@schmitch
schmitch / gist:fd2dcfc67b723f15520b
Created October 6, 2015 11:18
sbt-native-packager error
[vagrant@centos-7 vagrant]$ ./activator rpm:packageBin
[info] Loading project definition from /vagrant/project
[info] Set current project to loki-erp (in build file:/vagrant/)
[info] Updating {file:/vagrant/}pdfgen...
[info] Resolving org.springframework#spring-beans;3.0.6.RELEASE ...
[info] Packaging /vagrant/target/scala-2.11/loki-erp_2.11-1.3.2-sources.jar ...
[info] Resolving com.google.zxing#core;2.3.0 ...
[info] Done packaging.
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
@schmitch
schmitch / BodyFilter.scala
Created October 25, 2015 11:52
Scala Filter
import javax.inject.Inject
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.libs.json.{JsObject, JsString, Json}
import play.api.mvc._
import scala.concurrent.Future
class BodyFilter @Inject()() extends Filter {
@schmitch
schmitch / JsonAction.scala
Created October 25, 2015 12:04
Json Actions
package controllers
import javax.inject.Inject
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.libs.json.{JsObject, JsString, Json}
import play.api.mvc.{ActionBuilder, Request, Result}
import scala.concurrent.Future
package controllers
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.libs.json.{JsObject, JsString, Json}
import play.api.mvc.{Action, Results}
object EVRequest extends Results {
def json[A](action: Action[A]) = Action.async(action.parser) { request =>
action(request).map { result =>