This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="#" onclick="play('flute');">Flute</a> | |
<a href="#" onclick="play('piano');">Piano</a> | |
<script src="https://rawgithub.com/mudcube/MIDI.js/dev/build/MIDI.js" type="text/javascript"></script> | |
<script src="https://rawgithub.com/mudcube/MIDI.js/dev/inc/jasmid/stream.js" type="text/javascript" ></script> | |
<script src="https://rawgithub.com/mudcube/MIDI.js/dev/inc/jasmid/midifile.js" type="text/javascript"></script> | |
<script src="https://rawgithub.com/mudcube/MIDI.js/dev/inc/jasmid/replayer.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
window.onload = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class HistogramEntry[T](value: T, count: Int) | |
implicit class RichSeq[T](ts: Seq[T]) { | |
def histogram[U](f: T => U): Seq[HistogramEntry[U]] = | |
ts.groupBy(f) | |
.map { case (u, us) => HistogramEntry(u, us.size) } | |
.toSeq | |
.sortBy(_.count) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//earlier: | |
//var clickEventType=((document.ontouchstart!==null)?'click':'touchstart'); | |
$('.instrument').live(clickEventType, function(ev) { | |
ev.preventDefault(); | |
instrumentSelected($(this).data('instrumentname'), $(this).data('instrumentclef')); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function instrumentSelected(instrumentName, clef, onSuccess) { | |
mixerValues = { instrument:instrumentName, clef:clef }; | |
hoverValues = {}; | |
$.ajax({ | |
type: 'GET', | |
cache: false, | |
url: '/app/' + instrumentName + '/levels', | |
dataType: 'json', | |
success: function(data) { | |
currInstrumentAllLevelData = data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Goals: | |
// 1. Brief but non-crazy declarations of enums | |
// 2. easy binding to and from Strings | |
// 3. Namespacing, so that you don't have enum members floating at the top level | |
// 4. allow for additional state within each member | |
// 5. nice toString | |
//put the type outside of of the object, allowing you to import CardSuit._ | |
sealed abstract class CardSuit(val name: String) extends EnumMember | |
//put it in an object to namespace it - ala CardSuit.Hearts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
statically typed companion objects: | |
https://gist.github.com/4692921 | |
http://blogs.msdn.com/b/dsyme/archive/2013/01/30/twelve-type-providers-in-pictures.aspx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.NumberFormat | |
import scala.util.Try | |
object Conversions extends App { | |
object StandardConversions { | |
implicit val strToInt = (s: String) => s.toInt | |
} | |
object I18NConversions { | |
implicit val strToInt = (s: String) => NumberFormat.getIntegerInstance().parse(s).intValue() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i assume this is startup? | |
=INFO REPORT==== 15-Dec-2012::04:27:02 === | |
Limiting to approx 16284 file handles (14653 sockets) | |
=INFO REPORT==== 15-Dec-2012::04:27:02 === | |
Memory limit set to 29049MB of 72622MB total. | |
=INFO REPORT==== 15-Dec-2012::04:27:02 === | |
Disk free limit set to 1000MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api.mvc.PathBindable | |
import play.api.Play | |
import java.net.JarURLConnection | |
import Play.current | |
import java.io.File | |
import com.google.common.cache.CacheBuilder | |
import com.google.common.cache.CacheLoader | |
import java.net.URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> case class Address(street:String) | |
defined class Address | |
scala> case class Person(name:String, address:Address) | |
defined class Person | |
scala> val p1 = new Person("rick", Address("the street where rick lives street")) | |
p1: Person = Person(rick,Address(street street)) | |
scala> val Person(_, Address(ricksStreet)) = p1 |