Skip to content

Instantly share code, notes, and snippets.

@yareally
yareally / MyActivity.scala
Last active August 29, 2015 14:08
Scala features being used on Android
package com.example.android_scala
import android.app.Activity
import android.os.Bundle
import android.view.View
import android.view.View.OnClickListener
import android.widget.{Button, Toast}
import com.example.android_scala.MyActivity._
class MyActivity extends Activity {
class MainActivity
extends BaseActivity
with LoaderCallbacks[SharedPreferences] {
private var dbOnly : Boolean = false
private var enableDebug : Boolean = false
private var filteredSignals: Array[String] = null
private var fudgeSignal : Boolean = true
private var preferences : SharedPreferences = null
private var sigInfoIds : TypedArray = null
/*
Copyright (c) 2012 Wes Lanning, http://codingcreation.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
package com.cc.signalinfo.util
import android.app.Activity
import android.os.Bundle
import android.support.v4.app.LoaderManager.LoaderCallbacks
import android.support.v4.content.Loader
import android.view.View
import android.view.View.OnClickListener
/**
@yareally
yareally / DbHelpers.scala
Created May 6, 2015 03:11
Scala Slick testing on Android
package com.cc.AndroidSlick
import java.sql.{Driver, DriverManager}
import android.app.Activity
import android.media.MediaScannerConnection
import android.util.Log
import slick.profile.SqlProfile.ColumnOption.NotNull
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
def launchTestingSettings(activity: FragmentActivity) {
try {
activity.startActivity(AppHelpers.getAdditionalSettings)
}
catch {
case ignored: Any ⇒
val result = TerminalCommands.launchActivity("com.android.settings", "TestingSettings")
result.onComplete { case c ⇒
if (c.getOrElse(1) != 0) new NoSupportDialog().show(activity.getSupportFragmentManager, "Sorry")
@RunWith(classOf[JUnitRunner])
class ApplicationSpec extends Specification {
"Application" should {
"send 404 on a bad request" in new WithApplication{
route(FakeRequest(GET, "/boum")) must beNone
}
"render the index page" in new WithApplication{
[URL]
Protocol=unreal
Name=Player
Map=MenuMap.umap
LocalMap=MenuMap.umap
TransitionMap=ExampleEntry.umap
MapExt=umap
EXEName=WillowGame.exe
DebugEXEName=DEBUG-WillowGame.exe
SaveExt=usa
@yareally
yareally / app.ts
Last active September 4, 2015 14:33
/// <reference path="scripts/typings/easeljs/easeljs.d.ts"/>
/// <reference path="scripts/typings/jquery/jquery.d.ts"/>
class Circle {
circleShape: createjs.Shape;
/**
*
* @param x
* @param y
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>TypeScript HTML App</title>
<link rel="stylesheet" href="app.css" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://code.createjs.com/easeljs-0.8.1.min.js"></script>
<script src="app.js"></script>