Skip to content

Instantly share code, notes, and snippets.

View Morgaroth's full-sized avatar

MatJ Morgaroth

  • Kraków, Poland
View GitHub Profile
package demo
import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.{Global, Phase}
import scala.tools.nsc.plugins.{Plugin, PluginComponent}
class DemoPlugin(val global: Global) extends Plugin {
import global._
override def init(options: List[String], error: String => Unit): Boolean = true
// because window.status doesn't work anymore
// correct answers should be visible in another way
var items = document.body.getElementsByTagName('font')[0].getElementsByTagName('ol')[0].childNodes
for (var i = 0; i < items.length; ++i) {
var item = items[i];
if (item.tagName !== undefined) {
var header = item.getElementsByTagName('a')[0];
var text = ('' + header.onmouseover).slice(48, -16);
// console.log(text);
header.setAttribute('title', text);

problem

class class SOME CLASS is missing both @ScalaSig and .class file!

I checked this problem and message is some kind of lie. Problem really was that proguard removed ScalaSig class attribute.

solution

@Morgaroth
Morgaroth / mongodb casbah proguard.pro
Created October 8, 2015 22:28
preventing proguard inlining MBean interface, mongo db casbah
# javax.management.NotCompliantMBeanException: MBean class com.mongodb.ConnectionPoolStatistics does not implement
# DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException:
# Class com.mongodb.ConnectionPoolStatistics is not a JMX compliant Standard MBean) nor the MXBean
# conventions (javax.management.NotCompliantMBeanException: com.mongodb.ConnectionPoolStatistics: Class
# com.mongodb.ConnectionPoolStatistics is not a JMX compliant MXBean)
# Then probably You have enabled optimizations and interface com.mongodb.ConnectionPoolStatisticsMBean is inlined into class
# com.mongodb.ConnectionPoolStatistics, so to prevent errors simply keep this interface and implementing class with all fields
-keep interface com.mongodb.ConnectionPoolStatisticsMBean
@Morgaroth
Morgaroth / mongo_db1.pro
Last active October 8, 2015 21:57
keep proguard from removing implicit conversions to scala from file com.mongodb.casbah.Implicits (done by reflection calls)
# java.lang.NoSuchMethodException: b.a.a.g$b.asScala()
# thrown from com.mongodb.casbah.Implicits implicit conversions
-keepclassmembers class com.mongodb.casbah.Implicits$$anon$4 {
com.mongodb.casbah.MongoCollection asScala();
}
-keepclassmembers class com.mongodb.casbah.Implicits$$anon$5 {
com.mongodb.casbah.MongoDB asScala();
}
@Morgaroth
Morgaroth / build.sbt
Created September 21, 2015 17:55
multi jars in assembly task sbt assembly
val Server = config("server") extend Compile
inConfig(Server)(
baseAssemblySettings ++
inTask(assembly)(mainClass := Some("io.github.morgaroth.telegram.bot.test.WebServer")) ++
inTask(assembly)(assemblyJarName := s"test-bots-server-" + version.value + ".jar")
)
val Standalone = config("standalone") extend Compile
@Morgaroth
Morgaroth / App.scala
Last active October 8, 2015 21:35
TPR generator wykresów
package io.github.morgaroth.studia.semVII.tpr.lab1
import java.io.{File, FilenameFilter}
import scala.io.Source
object App {
def loadFilesWithPrefix(par: File, prefix: String): List[File] = {
@Morgaroth
Morgaroth / Procfile
Last active August 29, 2015 14:16
spray heroku
web: target/start -Dhttp.port=$PORT $JAVA_OPTS
@Morgaroth
Morgaroth / generate_imgs.sh
Created December 6, 2014 11:44
skrypt generujacy obrazki dobreg rozmiaru do apki androida
#!/bin/bash
filename=$1
if [ "$filename" == "" ];then
echo No file typed
else
mdpi_size="-resize 48X48"
hdpi_size="-resize 72X72"
xhdpi_size="-resize 96X96"
xxhdpi_size="-resize 144X144"
@Morgaroth
Morgaroth / compileidl.sh
Created May 4, 2014 21:26
compileidl on unix
#!/bin/sh
if [ "$1" == "--help" ] || [ "$1" == "-h" ]
then
echo "run this script in project root dir"
fi
idlj -fall -td ./generated -pkgTranslate example1 edu.sr.generated.example1 ./idl/sr.idl